:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --ink: #181a1f;
  --muted: #666d78;
  --line: #dedfd8;
  --accent: #b3262f;
  --accent-strong: #8f1d25;
  --teal: #1d6f73;
  --gold: #b7791f;
  --shadow: 0 12px 32px rgba(24, 26, 31, .08);

  /* サークルページ用ダークパレット（2026-06-13改訂: 紫基調＋ピンクアクセント） */
  --dk-bg: #161220;
  --dk-surface: #201a2e;
  --dk-surface2: #2a2240;
  --dk-ink: #ece8f4;
  --dk-muted: #9c93b2;
  --dk-line: rgba(200,180,255,.10);
  --dk-accent: #f25c8a;
  --dk-accent-strong: #d13e6f;
  --dk-teal: #3db8be;
  --dk-gold: #e0a835;
  --dk-shadow: 0 16px 40px rgba(22,10,40,.5);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.8;
}

a { color: inherit; }
img { max-width: 100%; }

.site-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 20px;
  background: rgba(247, 247, 244, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand-link,
.back-link {
  text-decoration: none;
  font-weight: 700;
}

.brand-link { letter-spacing: 0; }
.back-link { color: var(--muted); font-size: .92rem; }

.page-shell {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 28px 18px 64px;
}

/* eyebrow: 読者向けページでは使用しない。ポータル/admin で残す */
.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

/* platform 表示ラベル（作品ページ） */
.platform-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.home-hero,
.circle-hero {
  padding: 22px 0 26px;
  border-bottom: 1px solid var(--line);
}

.home-hero h1,
.circle-hero h1,
.work-summary h1 {
  margin: 0;
  font-feature-settings: "palt" 1;
  line-height: 1.16;
  letter-spacing: 0;
}

.home-hero h1 { font-size: clamp(2rem, 7vw, 4.4rem); }
.home-hero p { max-width: 640px; margin: 12px 0 0; color: var(--muted); }

.circle-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

/* コンパクトなサークル名ヘッダー（ヒーローより小さく上品に） */
.circle-hero h1 { font-size: clamp(1.2rem, 3.5vw, 1.9rem); }
.circle-logo {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface);
}

.profile {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 34px 0 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  font-feature-settings: "palt" 1;
  line-height: 1.25;
}

.count {
  color: var(--muted);
  font-size: .9rem;
  white-space: nowrap;
}

.works-grid {
  display: grid;
  /* 横長サムネ(4:3)に合わせて列をやや広く取る */
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.featured-grid {
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  margin-top: 20px;
}

.work-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(24, 26, 31, .04);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.work-card:hover {
  transform: translateY(-2px);
  border-color: rgba(179, 38, 47, .35);
  box-shadow: var(--shadow);
}

.work-card:active { transform: scale(.98); }

.work-card:focus-visible,
.work-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.work-link {
  display: grid;
  min-height: 100%;
  color: inherit;
  text-decoration: none;
}

.thumb-frame {
  position: relative;
  display: grid;
  aspect-ratio: 4 / 3; /* FANZA/DLsiteのパッケージは560x420の横長 */
  overflow: hidden;
  background: #ece8dd;
}

.work-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-missing,
.media-missing {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.discount-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 7px;
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  font-size: .72rem;
  font-weight: 800;
}

.work-body {
  display: grid;
  gap: 5px;
  padding: 11px 12px 12px;
}

.circle-name {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
}

.work-title {
  display: -webkit-box;
  min-height: 2.8em;
  overflow: hidden;
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.work-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: .8rem;
}

.sale-price {
  color: var(--accent);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* カード価格（通常） */
.work-meta span:not(.price-orig-sm) {
  font-variant-numeric: tabular-nums;
}

.tag-row,
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
}

.tag-row a,
.tag-cloud span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: .86rem;
  text-decoration: none;
  transition: color 200ms ease, border-color 200ms ease;
}

.tag-row a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tag-row a.is-active,
.tag-row a:hover {
  color: var(--accent-strong);
  border-color: rgba(179, 38, 47, .35);
}

.tag-row span,
.tag-cloud b {
  color: var(--muted);
  font-weight: 800;
}

.tag-row.compact {
  margin-top: 16px;
}

.circle-list {
  display: grid;
  gap: 10px;
}

.circle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 200ms ease;
}

.circle-row:hover { border-color: rgba(179, 38, 47, .35); }
.circle-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.circle-row span { display: grid; gap: 3px; min-width: 0; }
.circle-row strong { font-size: 1rem; }
.circle-row small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.circle-row em {
  color: var(--muted);
  font-size: .86rem;
  font-style: normal;
  white-space: nowrap;
}

.work-detail {
  display: grid;
  grid-template-columns: minmax(260px, 430px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-top: 18px;
}

.work-media {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.work-media img {
  display: block;
  width: 100%;
}

.work-summary {
  display: grid;
  gap: 14px;
}

.work-summary h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-feature-settings: "palt" 1;
  line-height: 1.35;
}
.byline { margin: 0; color: var(--muted); }
.byline a { color: var(--muted); font-weight: 700; text-decoration: none; }

.meta-list {
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
}

.meta-list div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.meta-list dt {
  color: var(--muted);
  font-size: .84rem;
}

.meta-list dd { margin: 0; }

.price-box {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 0;
}

.price-box strong {
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.price-box span {
  color: var(--muted);
  text-decoration: line-through;
  font-variant-numeric: tabular-nums;
}

.price-box em {
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(224, 69, 78, .12);
  color: var(--accent);
  font-size: .82rem;
  font-style: normal;
  font-weight: 800;
}

/* work-page: price-box 内クラス別スタイル */
.price-box .price-orig {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.price-box .price-now {
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.price-box .off-badge {
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(224, 69, 78, .12);
  color: var(--accent);
  font-size: .82rem;
  font-weight: 800;
}

.purchase-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: min(100%, 360px);
  padding: 12px 18px;
  border-radius: 6px;
  background: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0;
  transition: background 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.purchase-button:hover {
  background: var(--accent-strong);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 4px 12px rgba(24,26,31,.18);
  transform: translateY(-2px);
}

.purchase-button:active {
  transform: translateY(0) scale(.98);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}

.purchase-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.sample-grid img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.related-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

.empty-state {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.age-gate,
.error-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.gate,
.notice {
  width: min(460px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.gate h1,
.notice h1 {
  margin: 0 0 10px;
  font-size: 1.5rem;
}

.gate p,
.notice p {
  margin: 0;
  color: var(--muted);
}

.gate-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
}

.btn-yes { background: var(--accent); color: #fff; }
.btn-no { background: #ececea; color: var(--muted); }

.admin-shell {
  max-width: 1180px;
}

.admin-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 24px;
  border-bottom: 1px solid var(--line);
}

.admin-head h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.admin-head p:last-child {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
  text-align: right;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric-card span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 2rem;
  line-height: 1;
}

.admin-section {
  margin-top: 28px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.admin-table code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: .86em;
}

.compact-table {
  min-width: 860px;
}

@media (max-width: 720px) {
  .site-bar { padding: 0 14px; }
  .page-shell { padding: 22px 14px 48px; }
  .circle-hero { grid-template-columns: 1fr; }
  .works-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .work-detail { grid-template-columns: 1fr; }
  .work-title { font-size: .86rem; }
  .circle-row { align-items: start; }
  .circle-row small { white-space: normal; }
  .admin-head {
    align-items: start;
    flex-direction: column;
  }
  .admin-head p:last-child {
    text-align: left;
  }
  .metric-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .works-grid { grid-template-columns: 1fr; }
  .gate-actions { flex-direction: column; }
}

/* ================================================================
   サークルページ ダーク基調
   .circle-page ボディに適用。ポータル/admin/ゲートには影響しない。
   ================================================================ */
.circle-page {
  color: var(--dk-ink);
  background: var(--dk-bg);
}

.circle-page .site-bar {
  background: rgba(22, 18, 32, .92);
  border-bottom-color: var(--dk-line);
}

.circle-page .brand-link,
.circle-page .back-link {
  color: var(--dk-ink);
}

.circle-page .back-link { color: var(--dk-muted); }

/* --- ヒーローセクション（最新作大表示） --- */
.latest-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 480px) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  padding: 36px 0 40px;
  border-bottom: 1px solid var(--dk-line);
}

/* [#4] ヒーロー表紙: 4:3固定 + 最大幅 480px */
.latest-hero-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 10px;
  background: var(--dk-surface);
  box-shadow: var(--dk-shadow);
  max-width: 480px;
}

.latest-hero-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.latest-hero-thumb .discount-badge {
  top: 10px;
  left: 10px;
  font-size: .8rem;
  padding: 5px 9px;
  background: var(--dk-accent);
}

.latest-hero-info {
  display: grid;
  gap: 16px;
  align-content: center;
}

.latest-hero-title {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  font-feature-settings: "palt" 1;
  line-height: 1.2;
  color: var(--dk-ink);
}

.latest-hero-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.latest-hero-price .price-now {
  color: var(--dk-accent);
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.latest-hero-price .price-orig {
  color: var(--dk-muted);
  text-decoration: line-through;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.latest-hero-price .off-badge {
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(242, 92, 138, .15);
  color: var(--dk-accent);
  font-size: .8rem;
  font-weight: 800;
}

.latest-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 6px;
  background: var(--dk-surface2);
  border: 1px solid var(--dk-line);
  color: var(--dk-ink);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0;
  transition: border-color 200ms ease, background 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.btn-preview:hover {
  border-color: var(--dk-accent);
  background: rgba(242, 92, 138, .08);
  box-shadow: 0 4px 12px rgba(22,10,40,.4);
  transform: translateY(-2px);
}

.btn-preview:active {
  transform: translateY(0) scale(.98);
  box-shadow: none;
}

.btn-preview:focus-visible {
  outline: 2px solid var(--dk-accent);
  outline-offset: 2px;
}

.btn-detail {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 6px;
  background: var(--dk-accent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0;
  transition: background 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.btn-detail:hover {
  background: var(--dk-accent-strong);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 4px 12px rgba(22,10,40,.4);
  transform: translateY(-2px);
}

.btn-detail:active {
  transform: translateY(0) scale(.98);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}

.btn-detail:focus-visible {
  outline: 2px solid var(--dk-accent);
  outline-offset: 2px;
}

/* --- サークルプロフィール小ヘッダー --- */
.circle-page .circle-hero {
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--dk-line);
}

.circle-page .circle-hero h1 { color: var(--dk-ink); }
.circle-page .profile { color: var(--dk-muted); }
.circle-page .circle-logo { border-color: var(--dk-line); background: var(--dk-surface); }

/* --- タグナビ --- */
.circle-page .tag-row a {
  background: var(--dk-surface);
  border-color: var(--dk-line);
  color: var(--dk-muted);
}

.circle-page .tag-row a.is-active,
.circle-page .tag-row a:hover {
  color: var(--dk-accent);
  border-color: rgba(242, 92, 138, .4);
}

/* --- セクションヘッド --- */
.circle-page .section-head { border-bottom: none; }
.circle-page .section-head h2 { color: var(--dk-ink); }
.circle-page .count { color: var(--dk-muted); }

/* --- 作品グリッド（ダーク） --- */
.circle-page .work-card {
  background: var(--dk-surface);
  border-color: var(--dk-line);
}

.circle-page .work-card:hover {
  border-color: rgba(242, 92, 138, .4);
  box-shadow: 0 8px 24px rgba(22,10,40,.5);
}

.circle-page .work-title { color: var(--dk-ink); }
.circle-page .circle-name { color: var(--dk-muted); }
.circle-page .work-meta { color: var(--dk-muted); }
.circle-page .sale-price { color: var(--dk-accent); }
.circle-page .thumb-missing { color: var(--dk-muted); background: var(--dk-surface2); }
.circle-page .thumb-frame { background: var(--dk-surface2); }
.circle-page .discount-badge { background: var(--dk-accent); }
.circle-page .empty-state {
  background: var(--dk-surface);
  border-color: var(--dk-line);
  color: var(--dk-muted);
}

/* work-card 内の価格（定価打ち消し）ダーク対応 */
.circle-page .price-orig-sm {
  color: var(--dk-muted);
  text-decoration: line-through;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .latest-hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .latest-hero-thumb { max-width: 100%; }

  /* [#7] モバイルのタグ行: 右端見切れ防止 */
  .tag-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 14px;
    scrollbar-width: none;
  }
  .tag-row::-webkit-scrollbar { display: none; }
}

/* ================================================================
   試し読みリーダー（オーバーレイ）
   work-page で使用。circle-page からも呼び出し可能。
   開閉: visibility+opacity で display:flex を維持しつつフェード+scaleを実現。
   ================================================================ */
.reader-overlay {
  display: flex;
  visibility: hidden;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(10,11,16,.96);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(.98);
  transition: opacity 250ms ease-out, transform 250ms ease-out, visibility 0ms 250ms;
}

.reader-overlay.is-open {
  visibility: visible;
  opacity: 1;
  transform: scale(1);
  transition: opacity 250ms ease-out, transform 250ms ease-out, visibility 0ms 0ms;
}

@media (prefers-reduced-motion: reduce) {
  .reader-overlay {
    transition: none;
    transform: none;
  }
  .reader-overlay.is-open {
    transition: none;
    transform: none;
  }
}

.reader-close {
  position: absolute;
  top: 14px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  transition: background 200ms ease;
}
.reader-close:hover { background: rgba(255,255,255,.25); transform: translateY(-2px); }
.reader-close:active { transform: scale(.98); }
.reader-close:focus-visible {
  outline: 2px solid var(--dk-accent);
  outline-offset: 2px;
}

.reader-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 860px;
  padding: 0 56px;
}

/* 画像ラッパー（スピナーと画像を重ねる） */
.reader-img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reader-img {
  max-width: 100%;
  max-height: 88dvh;
  object-fit: contain;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.reader-img.is-loaded,
.reader-img.reader-img-visible {
  opacity: 1;
}

/* スピナー（CSSのみ実装） */
.reader-spinner {
  display: none;
  position: absolute;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: var(--dk-accent);
  border-radius: 50%;
  animation: reader-spin 600ms linear infinite;
}

@keyframes reader-spin {
  to { transform: rotate(360deg); }
}

/* prefers-reduced-motion: フェードとスピナーアニメーションを無効化 */
@media (prefers-reduced-motion: reduce) {
  .reader-img {
    opacity: 1;
    transition: none;
  }
  .reader-img.is-loaded,
  .reader-img.reader-img-visible {
    opacity: 1;
  }
  .reader-spinner {
    animation: none;
  }
}

.reader-cta-slide {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 320px;
  text-align: center;
  color: #e8eaf0;
}

.reader-cta-slide p {
  margin: 0;
  font-size: 1.1rem;
  opacity: .85;
}

.reader-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 28px;
  border-radius: 6px;
  background: var(--dk-accent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0;
  transition: background 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.reader-cta-btn:hover {
  background: var(--dk-accent-strong);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 4px 12px rgba(22,10,40,.4);
  transform: translateY(-2px);
}

.reader-cta-btn:active {
  transform: translateY(0) scale(.98);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}

.reader-cta-btn:focus-visible {
  outline: 2px solid var(--dk-accent);
  outline-offset: 2px;
}

.reader-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.13);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  transition: background 200ms ease, transform 200ms ease;
}

.reader-nav:hover {
  background: rgba(255,255,255,.28);
  transform: translateY(-50%) translateY(-1px);
}

.reader-nav:active { transform: translateY(-50%) scale(.98); }

.reader-nav:focus-visible {
  outline: 2px solid var(--dk-accent);
  outline-offset: 2px;
}

.reader-nav.prev { left: 6px; }
.reader-nav.next { right: 6px; }
.reader-nav:disabled { opacity: .25; cursor: default; }

.reader-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
  color: rgba(255,255,255,.6);
  font-size: .88rem;
}

/* ================================================================
   作品ページ 価格3点・アフィリ明記
   ================================================================ */
.affiliate-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .76rem;
}

.reader-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0;
  cursor: pointer;
  transition: border-color 200ms ease, background 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.reader-open-btn:hover {
  border-color: var(--accent);
  background: rgba(179, 38, 47, .04);
  box-shadow: 0 4px 10px rgba(24,26,31,.12);
  transform: translateY(-2px);
}

.reader-open-btn:active {
  transform: translateY(0) scale(.98);
  box-shadow: none;
}

.reader-open-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ================================================================
   [#2] リーダー hidden 要素の強制非表示
   display 指定が [hidden] 属性に勝るケースを防ぐ
   ================================================================ */
.reader-cta-slide[hidden],
.reader-img[hidden] {
  display: none !important;
}

/* ================================================================
   [#3] off-badge の打ち消し線継承を禁止
   price-box 内・ヒーロー内とも適用
   ================================================================ */
.off-badge {
  text-decoration: none;
}

/* ================================================================
   [#5] 画像リンク切れフォールバック
   .thumb-frame / .latest-hero-thumb / .work-media 内の img が
   読み込み失敗したとき、JS で親要素に is-broken クラスを付与。
   CSS 側は面色背景 + 中央「画像準備中」表示。
   ================================================================ */
.is-broken {
  display: grid;
  place-items: center;
  background: var(--surface);
}

.circle-page .is-broken,
.work-page .is-broken {
  background: var(--dk-surface);
}

.is-broken::after {
  content: "画像準備中";
  color: var(--muted);
  font-size: .85rem;
  font-weight: 700;
  text-align: center;
  padding: 12px;
}

.circle-page .is-broken::after,
.work-page .is-broken::after {
  color: var(--dk-muted);
}

/* バッジが .is-broken 親と重ならないようにバッジの z-index を明示 */
.discount-badge { position: absolute; z-index: 1; }

/* ================================================================
   [#1][#6] 作品ページ（.work-page）ダークテーマ
   circle-page と同じパレットを work-page スコープで適用。
   ポータル/admin/ゲート/for-circles には影響しない。
   ================================================================ */
.work-page {
  color: var(--dk-ink);
  background: var(--dk-bg);
}

/* サイトバー */
.work-page .site-bar {
  background: rgba(22, 18, 32, .92);
  border-bottom-color: var(--dk-line);
}

.work-page .brand-link {
  color: var(--dk-ink);
}

.work-page .back-link {
  color: var(--dk-muted);
}

/* 作品詳細エリア */
.work-page .work-media {
  background: var(--dk-surface);
  border-color: var(--dk-line);
}

.work-page .platform-label {
  color: var(--dk-muted);
}

.work-page .byline,
.work-page .byline a {
  color: var(--dk-muted);
}

/* メタリスト */
.work-page .meta-list div {
  border-bottom-color: var(--dk-line);
}

.work-page .meta-list dt {
  color: var(--dk-muted);
}

/* 価格ボックス */
.work-page .price-box .price-orig {
  color: var(--dk-muted);
}

.work-page .price-box .price-now,
.work-page .price-box strong {
  color: var(--dk-accent);
}

.work-page .price-box .off-badge {
  background: rgba(242, 92, 138, .15);
  color: var(--dk-accent);
  text-decoration: none;
}

.work-page .price-box span {
  color: var(--dk-muted);
}

/* タグ行 */
.work-page .tag-row a {
  background: var(--dk-surface);
  border-color: var(--dk-line);
  color: var(--dk-muted);
}

.work-page .tag-row a:hover {
  color: var(--dk-accent);
  border-color: rgba(242, 92, 138, .4);
}

.work-page .tag-row a:focus-visible {
  outline-color: var(--dk-accent);
}

/* 試し読みボタン（アウトライン） */
.work-page .reader-open-btn {
  background: var(--dk-surface);
  border-color: var(--dk-line);
  color: var(--dk-ink);
}

.work-page .reader-open-btn:hover {
  border-color: rgba(242, 92, 138, .5);
  background: rgba(242, 92, 138, .08);
}

.work-page .reader-open-btn:focus-visible {
  outline-color: var(--dk-accent);
}

/* 購入ボタン（主ストア: 塗りつぶし） */
.work-page .purchase-button {
  background: var(--dk-accent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}

.work-page .purchase-button:hover {
  background: var(--dk-accent-strong);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 4px 12px rgba(22,10,40,.4);
}

.work-page .purchase-button:focus-visible {
  outline-color: var(--dk-accent);
}

/* 副ストアボタン（アウトライン: ストア公式色禁止・アクセント1色ルール維持） */
.work-page .purchase-button--sub {
  background: transparent;
  border: 2px solid var(--dk-accent);
  color: var(--dk-accent);
  box-shadow: none;
  margin-top: 8px;
}

.work-page .purchase-button--sub:hover {
  background: var(--dk-accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(22,10,40,.4);
}

.work-page .purchase-button--sub:focus-visible {
  outline-color: var(--dk-accent);
}

/* アフィリ注記 */
.work-page .affiliate-note {
  color: var(--dk-muted);
}

/* 関連作品セクション */
.work-page .section-head h2 {
  color: var(--dk-ink);
}

/* 関連作品カード（work-card）ダーク化 [#6] */
.work-page .work-card {
  background: var(--dk-surface);
  border-color: var(--dk-line);
}

.work-page .work-card:hover {
  border-color: rgba(242, 92, 138, .4);
  box-shadow: 0 8px 24px rgba(22,10,40,.5);
}

.work-page .work-title { color: var(--dk-ink); }
.work-page .circle-name { color: var(--dk-muted); }
.work-page .work-meta { color: var(--dk-muted); }
.work-page .sale-price { color: var(--dk-accent); }
.work-page .thumb-missing { color: var(--dk-muted); background: var(--dk-surface2); }
.work-page .thumb-frame { background: var(--dk-surface2); }
.work-page .discount-badge { background: var(--dk-accent); }

/* work-card の定価打ち消しダーク */
.work-page .price-orig-sm {
  color: var(--dk-muted);
  text-decoration: line-through;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}

/* ================================================================
   §2c d. ヒーロー表紙 初回浮き上がりアニメーション（400ms・1回のみ）
   スクロール連動・ループ禁止。prefers-reduced-motion で無効化。
   ================================================================ */
@keyframes hero-rise {
  from {
    opacity: .85;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.latest-hero-thumb {
  animation: hero-rise 400ms ease-out 1 both;
}

@media (prefers-reduced-motion: reduce) {
  .latest-hero-thumb {
    animation: none;
  }
}

/* ================================================================
   §2c a. リーダー開閉 prefers-reduced-motion 追加（上の
   .reader-overlay ブロックとは別に visibility を確実に制御）
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  .reader-overlay {
    opacity: 0;
    transform: none;
    transition: opacity 1ms, visibility 0ms 1ms;
  }
  .reader-overlay.is-open {
    opacity: 1;
    transition: opacity 1ms, visibility 0ms 0ms;
  }
}
