/* ========================================
   CSS Variables / Theme
   Web フォント（Noto Sans JP）は各ページの <head> で読み込む
   （lib/templates.js の FONT_LINKS）。
   生成りの紙 + 墨 + 朱 の3色が基本。
   カードの影・大きな角丸・グラデーションは使わず、罫線と余白で区切る。
   ======================================== */
:root {
  --color-bg: #F5F0E6;          /* 生成り（ページ背景） */
  --color-surface: #FAF7F0;     /* 盤面・表などの少し明るい面 */
  --color-tint: #EDE5D5;        /* 本の紹介枠などの少し濃い面 */
  --color-primary: #2B2724;     /* 墨（見出し） */
  --color-accent: #B5432F;      /* 朱（リンク・強調） */
  --color-gold: #B5432F;        /* 旧アクセント。朱に統一 */
  --color-purchase: #B5432F;
  --color-purchase-hover: #93331F;
  --color-purchase-soft: #EDE5D5;
  --color-purchase-border: #B5432F;
  --color-purchase-text: #B5432F;
  --color-text: #2B2724;
  --color-text-muted: #6B6259;
  --color-border: #D6CBB8;      /* 罫線 */
  --color-hover: #EDE5D5;
  --color-wood: #C4A276;        /* 本棚の棚板 */
  --color-wood-dark: #9C7A50;

  --radius: 2px;
  --radius-lg: 2px;
  --shadow: none;
  --shadow-hover: none;

  --max-width: 1040px;
  --read-width: 720px;
  --header-height: 57px;
  --books-nav-height: 42px;
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", "Segoe UI",
    "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  line-height: 1.85;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

p + p {
  margin-top: 0.75rem;
}

::selection {
  background: rgba(181, 67, 47, 0.18);
}

/* ========================================
   Layout
   ======================================== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
}

/* ========================================
   Site Header
   ======================================== */
.site-header {
  background: var(--color-bg);
  color: var(--color-text);
  padding: 0.9rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--color-border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.04em;
}

.site-logo:hover {
  text-decoration: none;
  color: var(--color-accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.site-nav a {
  color: var(--color-text-muted);
  font-size: 0.86rem;
  white-space: nowrap;
  transition: color 0.15s;
}

.site-nav a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.site-nav a.nav-external::after {
  content: "\2197";
  font-size: 0.8em;
  margin-left: 0.15em;
  color: var(--color-text-muted);
}

/* 現在のページ（lib/templates.js の renderHeader が付与） */
.site-nav a.is-current {
  color: var(--color-text);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.lang-switch {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}

.lang-switch:hover {
  text-decoration: none !important;
}

/* ========================================
   Breadcrumb
   ======================================== */
.breadcrumb {
  padding: 1.1rem 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--color-text-muted);
}

.breadcrumb a:hover {
  color: var(--color-accent);
}

.breadcrumb-sep {
  color: var(--color-border);
}

/* ========================================
   Hero Section（ページの表題）
   ======================================== */
.hero {
  background: transparent;
  color: var(--color-text);
  padding: 4.5rem 0 3.5rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}

.hero-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--color-accent);
  margin-bottom: 0.85rem;
}

.hero-title {
  font-size: clamp(1.6rem, 3.5vw, 2.3rem);
  font-weight: 700;
  margin-bottom: 0.9rem;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.hero-format {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  padding: 0.1rem 0.8rem;
  letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--color-text-muted);
  max-width: 580px;
  margin: 0 auto;
}

.hero-ku {
  margin-top: 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
}

.hero-ku strong {
  color: var(--color-accent);
  font-weight: 700;
}

.hero-ku a {
  color: inherit;
  text-decoration: none;
}

.hero-ku a:hover {
  text-decoration: underline;
}

/* ========================================
   Hero — 本棚（本の紹介ページ）
   暗い壁に照明を当てた本棚。表紙の色を主役にする。
   ======================================== */
.hero-shelf {
  --wall: #2A221C;
  --wall-text: #F5F0E6;
  --wall-muted: rgba(245, 240, 230, 0.72);
  --label-h: 1.3rem;
  --label-gap: 1.6rem;
  --plank-h: 14px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 72%, rgba(255, 214, 150, 0.16), transparent 70%),
    var(--wall);
  color: var(--wall-text);
  text-align: left;
  padding: 4rem 0 3.25rem;
  border-bottom: none;
}

.shelf-text {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem 3rem;
  flex-wrap: wrap;
  margin-bottom: 3.25rem;
}

.hero-shelf .hero-format {
  color: #E88A6F;
  border-color: currentColor;
  margin-bottom: 1rem;
}

.hero-shelf .hero-title {
  font-size: clamp(1.9rem, 4.8vw, 3rem);
  line-height: 1.25;
  letter-spacing: 0.03em;
  margin: 0;
}

.shelf-intro {
  max-width: 400px;
}

.hero-shelf .hero-subtitle {
  color: var(--wall-muted);
  font-size: 0.95rem;
  margin: 0;
}

/* 固定の改行を外し、幅に合わせて自然に折り返す */
.hero-shelf .hero-subtitle br {
  display: none;
}

.hero-shelf .hero-ku {
  color: var(--wall-text);
  margin-top: 0.9rem;
}

.hero-shelf .hero-ku strong {
  color: #E88A6F;
}

.shelf {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 3.5vw, 40px);
  padding: 0 clamp(8px, 3vw, 32px);
}

.shelf-five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 600px) {
  .shelf-five {
    grid-template-columns: repeat(5, minmax(100px, 1fr));
    overflow-x: auto;
    padding-bottom: 24px;
  }

  .shelf-five::before {
    bottom: calc(var(--label-h) + var(--label-gap) - var(--plank-h) + 24px);
    width: calc(500px + 4 * clamp(12px, 3.5vw, 40px) + 2 * clamp(8px, 3vw, 32px));
    min-width: 100%;
  }
}

/* 棚板：表紙の下端にぴったり合わせる */
.shelf::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--label-h) + var(--label-gap) - var(--plank-h));
  height: var(--plank-h);
  background: linear-gradient(var(--color-wood), #B08D60);
  box-shadow: 0 5px 0 var(--color-wood-dark), 0 18px 24px rgba(0, 0, 0, 0.45);
}

.shelf-book {
  position: relative;
  display: flex;
  flex-direction: column;
  color: var(--wall-muted);
  text-decoration: none;
}

.shelf-book img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  box-shadow: 4px 0 0 rgba(0, 0, 0, 0.25), 6px 10px 22px rgba(0, 0, 0, 0.5);
  transition: transform 0.25s, box-shadow 0.25s;
}

.shelf-label {
  display: block;
  height: var(--label-h);
  margin-top: var(--label-gap);
  font-size: 0.8rem;
  line-height: var(--label-h);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

.shelf-label .nav-num {
  color: #E88A6F;
  font-weight: 700;
  margin-right: 0.45em;
}

.shelf-book:hover {
  text-decoration: none;
}

.shelf-book:hover img {
  transform: translateY(-12px);
  box-shadow: 4px 0 0 rgba(0, 0, 0, 0.25), 8px 22px 30px rgba(0, 0, 0, 0.55);
}

.shelf-book:hover .shelf-label {
  color: var(--wall-text);
}

.shelf-book:focus-visible {
  outline: 2px solid #E88A6F;
  outline-offset: 6px;
}

/* ========================================
   Gate — サイトのトップ（言語選択）
   本の紹介ページと同じ「暗い壁の本棚」を日英で左右に並べる。
   ======================================== */
.gate-page {
  background: #2A221C;
}

.gate {
  --wall-text: #F5F0E6;
  --wall-muted: rgba(245, 240, 230, 0.68);
  --shu-light: #E88A6F;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--wall-text);
  background:
    radial-gradient(ellipse 40% 55% at 25% 62%, rgba(255, 214, 150, 0.13), transparent 70%),
    radial-gradient(ellipse 40% 55% at 75% 62%, rgba(255, 214, 150, 0.13), transparent 70%),
    #2A221C;
}

.gate-brand {
  text-align: center;
  padding: clamp(3rem, 9vh, 5.5rem) 1.5rem 0;
}

.gate-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

.gate-title span {
  display: block;
  font-size: 0.42em;
  letter-spacing: 0.12em;
  color: var(--wall-muted);
  margin-top: 0.4rem;
}

.gate-copy {
  margin-top: 1.6rem;
  font-size: clamp(1.1rem, 2.6vw, 1.4rem);
  font-weight: 700;
  line-height: 1.6;
  color: var(--shu-light);
}

.gate-copy span {
  display: block;
  font-size: 0.68em;
  font-weight: 400;
  color: var(--wall-muted);
}

.gate-desc {
  margin-top: 1.1rem;
  font-size: 0.95rem;
  line-height: 1.7;
}

.gate-desc span {
  display: block;
  font-size: 0.86em;
  color: var(--wall-muted);
}

.gate-byline {
  margin-top: 0.9rem;
  font-size: 0.82rem;
  color: var(--wall-muted);
}

.gate-sides {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vh, 4.5rem) 1.5rem 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.gate-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
}

.gate-side + .gate-side {
  border-left: 1px solid rgba(245, 240, 230, 0.14);
}

.gate-enter {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  color: var(--wall-text);
}

.gate-enter:hover {
  text-decoration: none;
}

.gate-lang {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--shu-light);
  margin-bottom: 1.5rem;
}

.gate-side h2.gate-lang {
  font-size: 0.8rem;
}

.gate-shelf-label {
  display: block;
  margin-bottom: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--wall-muted);
}

.gate-shelf-label strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 1.1rem;
  color: var(--wall-text);
}

.gate-shelf {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: clamp(8px, 1.6vw, 18px);
  width: 100%;
  padding: 0 clamp(6px, 1.5vw, 16px);
  border-bottom: 12px solid var(--color-wood);
  box-shadow: 0 5px 0 var(--color-wood-dark), 0 18px 24px rgba(0, 0, 0, 0.45);
}

.gate-shelf img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  box-shadow: 3px 0 0 rgba(0, 0, 0, 0.25), 5px 8px 18px rgba(0, 0, 0, 0.5);
  transition: transform 0.25s;
}

.gate-enter:hover .gate-shelf img {
  transform: translateY(-8px);
}

.gate-enter:hover .gate-shelf img:nth-child(2) { transition-delay: 0.03s; }
.gate-enter:hover .gate-shelf img:nth-child(3) { transition-delay: 0.06s; }
.gate-enter:hover .gate-shelf img:nth-child(4) { transition-delay: 0.09s; }
.gate-enter:hover .gate-shelf img:nth-child(5) { transition-delay: 0.12s; }

.gate-cta {
  margin-top: 2.25rem;
  padding: 0.7rem 1.8rem;
  border: 1px solid var(--wall-text);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: background 0.2s, color 0.2s;
}

.gate-enter:hover .gate-cta,
.gate-enter:focus-visible .gate-cta {
  background: var(--wall-text);
  color: #2A221C;
}

.gate-enter:focus-visible {
  outline: none;
}

/* 中身の一覧（何が読めるか） */
.gate-menu {
  list-style: none;
  width: 100%;
  max-width: 440px;
  margin-top: 2.25rem;
  border-top: 1px solid rgba(245, 240, 230, 0.16);
}

.gate-menu a {
  display: block;
  padding: 0.75rem 1.6rem 0.75rem 0.25rem;
  border-bottom: 1px solid rgba(245, 240, 230, 0.16);
  color: var(--wall-text);
  position: relative;
}

.gate-menu a::after {
  content: "\2192";
  position: absolute;
  right: 0.25rem;
  top: 50%;
  margin-top: -0.8em;
  color: var(--wall-muted);
  transition: transform 0.15s, color 0.15s;
}

.gate-menu a.is-external::after {
  content: "\2197";
}

.gate-menu a:hover {
  text-decoration: none;
}

.gate-menu a:hover strong,
.gate-menu a:hover::after {
  color: var(--shu-light);
}

.gate-menu a:hover::after {
  transform: translateX(3px);
}

.gate-menu strong {
  display: block;
  font-size: 0.95rem;
  transition: color 0.15s;
}

.gate-menu span {
  display: block;
  font-size: 0.82rem;
  color: var(--wall-muted);
  line-height: 1.6;
}

/* 最新の問題（build-problems.js が中身を書き換える） */
.gate-problem {
  width: 100%;
  max-width: 440px;
  margin-top: 2.25rem;
}

.gate-problem-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--shu-light);
  margin-bottom: 0.6rem;
}

.gate-problem-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0.75rem;
  border: 1px solid rgba(245, 240, 230, 0.22);
  background: rgba(245, 240, 230, 0.05);
  color: var(--wall-text);
  transition: border-color 0.15s, background 0.15s;
}

.gate-problem-card:hover {
  text-decoration: none;
  border-color: var(--shu-light);
  background: rgba(245, 240, 230, 0.09);
}

.gate-problem-card img {
  width: 100%;
  height: auto;
  background: #fff;
}

.gate-problem-card strong {
  display: block;
  font-size: 0.95rem;
}

.gate-problem-card .gate-problem-title {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--wall-text);
}

.gate-problem-card .gate-problem-go {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.35rem 1rem;
  background: var(--shu-light);
  color: #2A221C;
  font-size: 0.88rem;
  font-weight: 700;
  transition: background 0.15s;
}

.gate-problem-card:hover .gate-problem-go {
  background: var(--wall-text);
}

.gate-problem-all {
  display: block;
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(245, 240, 230, 0.45);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--wall-text);
  text-align: center;
  transition: background 0.15s, color 0.15s;
}

.gate-problem-all:hover {
  text-decoration: none;
  background: var(--wall-text);
  color: #2A221C;
}

.gate-footer {
  text-align: center;
  font-size: 0.75rem;
  color: rgba(245, 240, 230, 0.45);
  padding: 1.5rem;
}

/* 日英で本棚・最新の問題・一覧の段をそろえる（2列のときだけ） */
@media (min-width: 721px) {
  .gate-sides {
    grid-template-rows: repeat(5, auto);
  }

  .gate-side {
    display: grid;
    grid-row: span 5;
    grid-template-rows: subgrid;
    justify-items: center;
    align-items: start;
  }

  .gate-side .gate-enter {
    align-self: end;
  }
}

@media (max-width: 720px) {
  .gate-sides {
    grid-template-columns: 1fr;
    gap: 3.5rem;
  }

  .gate-side + .gate-side {
    border-left: none;
  }

  /* ブラウザの言語に合う側を先に */
  .gate-side.is-preferred {
    order: -1;
  }
}

/* ========================================
   Generic Section
   ======================================== */
.section {
  padding: 3.5rem 0;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 1.5rem;
}

.section-lead {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  max-width: 660px;
}

/* ========================================
   Book Cards (grid / list page)
   ======================================== */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 2.5rem 2rem;
}

.book-card {
  display: flex;
  flex-direction: column;
  color: var(--color-text);
}

.book-card:hover {
  text-decoration: none;
  color: var(--color-text);
}

.book-card:hover .book-card-title {
  color: var(--color-accent);
}

.book-card-cover {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.book-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Placeholder cover (no image) */
.book-card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-tint);
  color: var(--color-text-muted);
  text-align: center;
  padding: 1.5rem;
  gap: 0.75rem;
}

.book-card-cover-placeholder .piece {
  font-size: 3rem;
  line-height: 1;
}

.book-card-cover-placeholder .title {
  font-size: 0.85rem;
  line-height: 1.5;
}

.book-card-body {
  padding: 1rem 0 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.book-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.5;
}

.book-card-subtitle {
  font-size: 0.83rem;
  color: var(--color-text-muted);
}

.book-card-desc {
  font-size: 0.88rem;
  line-height: 1.75;
  flex: 1;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

.book-card-link {
  align-self: flex-start;
  color: var(--color-accent);
  font-size: 0.88rem;
  font-weight: 700;
  margin-top: auto;
}

.book-card-link::after {
  content: " \2192";
}

/* ========================================
   Book Detail — Hero
   ======================================== */
.book-hero {
  padding: 3rem 0;
  border-bottom: 1px solid var(--color-border);
}

.book-hero-inner {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3rem;
  align-items: start;
}

.book-cover-wrap {
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.book-cover-placeholder {
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-tint);
  color: var(--color-text-muted);
  text-align: center;
  padding: 2rem;
  gap: 1rem;
}

.book-cover-placeholder .piece {
  font-size: 4.5rem;
  line-height: 1;
}

.book-cover-placeholder .title {
  font-size: 0.95rem;
  line-height: 1.55;
  font-weight: 700;
}

.book-meta {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.book-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--color-accent);
  font-weight: 700;
}

.book-title {
  font-size: clamp(1.4rem, 2.8vw, 1.9rem);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.45;
}

.book-subtitle {
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.kindle-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text);
  border: 1px solid var(--color-text);
  padding: 0.1rem 0.7rem;
  letter-spacing: 0.03em;
  width: fit-content;
}

.kindle-badge::before {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  background: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 2H5a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2zm-7 14l-5-5 1.41-1.41L12 13.17l7.59-7.59L21 7l-9 9z'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 2H5a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2zm-7 14l-5-5 1.41-1.41L12 13.17l7.59-7.59L21 7l-9 9z'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.book-tags {
  display: flex;
  gap: 0.4rem 0.9rem;
  flex-wrap: wrap;
  margin-top: 0.1rem;
}

.tag {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.tag::before {
  content: "#";
  margin-right: 0.1em;
  color: var(--color-accent);
}

.book-purchase {
  margin-top: 1.25rem;
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
  border: 1px solid transparent;
  letter-spacing: 0.03em;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-bg);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

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

.btn-disabled {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
  cursor: default;
}

.btn-disabled:hover {
  color: var(--color-text-muted);
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-text);
}

.btn-outline:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

/* ========================================
   Book Detail — Content Sections
   ======================================== */
.book-sections {
  display: flex;
  flex-direction: column;
}

.book-section {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.book-section:last-child {
  border-bottom: none;
}

.book-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 1rem;
}

/* ========================================
   Lists
   ======================================== */
.styled-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.styled-list li {
  padding-left: 1.2rem;
  position: relative;
  font-size: 0.95rem;
}

.styled-list li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.8em;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--color-text);
}

/* ========================================
   Table of Contents
   ======================================== */
.toc-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--color-border);
}

.toc-item {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.8rem 0.25rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.93rem;
}

.toc-num {
  font-size: 0.78rem;
  color: var(--color-accent);
  font-weight: 700;
  min-width: 4.5rem;
  flex-shrink: 0;
}

/* Expandable TOC */
.toc-expandable {
  display: block;
  padding: 0;
}

.toc-expandable summary {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.8rem 0.25rem;
  cursor: pointer;
  list-style: none;
}

.toc-expandable summary::-webkit-details-marker {
  display: none;
}

.toc-expandable summary::after {
  content: "+";
  margin-left: auto;
  font-size: 1rem;
  line-height: 1;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.toc-expandable[open] summary::after {
  content: "\2212";
}

.toc-expandable summary:hover {
  color: var(--color-accent);
}

.toc-sub {
  list-style: none;
  padding: 0 0 0.8rem;
}

.toc-sub li {
  padding: 0.25rem 0.25rem 0.25rem 5.75rem;
  font-size: 0.87rem;
  color: var(--color-text-muted);
  position: relative;
}

.toc-sub li::before {
  content: "\2013";
  position: absolute;
  left: 4.6rem;
  color: var(--color-border);
}

/* ========================================
   Author Box
   ======================================== */
.author-box {
  border-top: 1px solid var(--color-border);
  padding: 2rem 0 0;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.author-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  overflow: hidden;
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.3rem;
  color: var(--color-primary);
}

.author-bio {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.85;
}

.author-bio .books-link {
  font-weight: 700;
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.author-bio .books-link:hover {
  opacity: 0.75;
}

/* ========================================
   Related Books (compact grid)
   ======================================== */
.related-books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

/* ========================================
   Language Selector (root page)
   ======================================== */
.lang-selector {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: var(--color-bg);
}

.lang-selector-icon {
  font-size: 5rem;
  line-height: 1;
  color: var(--color-primary);
  margin-bottom: 1.25rem;
  font-weight: 700;
}

.lang-selector-title {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.lang-selector-subtitle {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-bottom: 3rem;
  letter-spacing: 0.05em;
}

.lang-buttons {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.lang-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.5rem 2.75rem;
  border: 1px solid var(--color-text);
  color: var(--color-text);
  min-width: 168px;
  transition: background 0.15s, color 0.15s;
}

.lang-btn:hover {
  background: var(--color-text);
  color: var(--color-bg);
  text-decoration: none;
}

.lang-btn .label {
  font-size: 1.15rem;
  font-weight: 700;
}

.lang-btn .sub {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* ========================================
   Footer
   ======================================== */
.site-footer {
  background: transparent;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  padding: 1.75rem 0 2rem;
  text-align: center;
  font-size: 0.8rem;
  margin-top: auto;
}

.site-footer a {
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer a:hover {
  color: var(--color-accent);
}

.support-link {
  margin-bottom: 0.5rem;
}

.site-footer .support-link a {
  color: var(--color-accent);
  font-weight: 700;
}

.site-footer .support-link a::after {
  content: " \2197";
  font-weight: 400;
}

.affiliate-notice {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-bottom: 0.5rem;
}

/* ========================================
   X Share Button
   ======================================== */
.article-share {
  margin: 2.5rem 0 1rem;
  display: flex;
  justify-content: flex-start;
}

.btn-x-share {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
  border: 1px solid var(--color-text);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 1.1rem;
  transition: background 0.15s, color 0.15s;
}

.btn-x-share:hover {
  background: var(--color-text);
  color: var(--color-bg);
  text-decoration: none;
}

/* ========================================
   Books Nav (single-page anchor navigation)
   ======================================== */
.books-nav {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: var(--header-height);
  z-index: 99;
}

.books-nav .container {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}

.books-nav .container::-webkit-scrollbar {
  display: none;
}

.books-nav a {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  padding: 0.65rem 1.1rem 0.65rem 0;
  margin-right: 0.4rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
}

.books-nav a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.books-nav .nav-num {
  font-size: 0.72rem;
  color: var(--color-accent);
  font-weight: 700;
}

/* ========================================
   Book Page Section (single-page view)
   ======================================== */
.book-page-section {
  padding: 4rem 0;
  scroll-margin-top: calc(var(--header-height) + var(--books-nav-height) + 12px);
}

/* main 内の section 順は hero → book1 → book2 … なので、odd が 2冊目・4冊目 */
.book-page-section:nth-of-type(odd) {
  background: var(--color-tint);
}

.book-page-header {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin-bottom: 2rem;
}

.book-num-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: 0.1em;
  line-height: 1;
  flex-shrink: 0;
}

.book-page-title {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.book-intro {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  align-items: start;
  margin-bottom: 2.5rem;
}

.book-details {
  display: flex;
  flex-direction: column;
  max-width: 760px;
}

.book-detail-section {
  padding: 1.75rem 0;
  border-top: 1px solid var(--color-border);
}

.book-detail-section:last-child {
  padding-bottom: 0;
}

/* Jump links to other books */
.other-books-links {
  display: flex;
  gap: 0.4rem 1.4rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.other-books-links a {
  font-size: 0.88rem;
  color: var(--color-accent);
  font-weight: 700;
}

.other-books-links a::after {
  content: " \2192";
}

/* ========================================
   Blog Post List
   ======================================== */
.post-list {
  display: flex;
  flex-direction: column;
  max-width: var(--read-width);
  margin: 0 auto;
  border-top: 1px solid var(--color-border);
}

.post-card {
  display: block;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.post-card:hover {
  text-decoration: none;
  color: var(--color-text);
}

.post-card:hover .post-card-title {
  color: var(--color-accent);
}

.post-card.has-thumb {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.post-card-thumb {
  width: 160px;
  flex-shrink: 0;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--color-tint);
}

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

.post-card-body {
  flex: 1;
  min-width: 0;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.post-card-category {
  color: var(--color-accent);
}

.post-card-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.6;
  margin-bottom: 0.4rem;
  transition: color 0.15s;
}

.post-card-excerpt {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.8;
}

.post-card-readmore {
  display: none;
}

/* ========================================
   Blog Article Page
   ======================================== */
.container > article,
.container > article ~ .section,
.container > .breadcrumb {
  max-width: var(--read-width);
  margin-left: auto;
  margin-right: auto;
}

.container > article ~ .section {
  padding-top: 1rem;
}

.article-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2.5rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.article-category {
  color: var(--color-accent);
}

.article-title {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.5;
  margin-bottom: 0.9rem;
  letter-spacing: 0.01em;
}

.article-lead {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.85;
}

.article-body {
  font-size: 1.0625rem;
  line-height: 2;
  color: var(--color-text);
}

.article-body h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.5;
  margin-top: 3rem;
  margin-bottom: 0.9rem;
}

.article-body h3 {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 2.2rem;
  margin-bottom: 0.5rem;
}

.article-body p {
  margin-bottom: 1.5em;
}

.article-body p + p {
  margin-top: 0;
}

.article-body ul,
.article-body ol {
  padding-left: 1.3rem;
  margin-bottom: 1.5em;
}

.article-body li {
  margin-bottom: 0.3em;
}

.article-body ul li::marker {
  color: var(--color-text);
}

.article-body strong {
  font-weight: 700;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 3rem 0 2rem;
}

.article-thumb {
  width: 100%;
  margin-bottom: 2rem;
}

.article-thumb img {
  width: 100%;
  height: auto;
  max-height: 380px;
  object-fit: contain;
  display: block;
}

/* ========================================
   Course pages — 入門ガイド・囲い（一覧／各ステップ）
   ======================================== */
.course-intro {
  max-width: 680px;
  margin: 0 auto;
}

.course-intro > p {
  line-height: 1.85;
  margin-bottom: 1.2rem;
}

.course-badge {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.course-cards {
  display: flex;
  flex-direction: column;
  margin-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.course-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.3rem 0.25rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.course-card:hover {
  color: var(--color-text);
  text-decoration: none;
}

.course-card-num {
  flex-shrink: 0;
  width: 2rem;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--color-accent);
  line-height: 1;
}

.course-card-body {
  flex: 1;
}

.course-card-title {
  font-weight: 700;
  font-size: 1.02rem;
  margin-bottom: 0.2rem;
  transition: color 0.15s;
}

.course-card-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.course-card-arrow {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: transform 0.15s, color 0.15s;
}

.course-card:hover .course-card-title {
  color: var(--color-accent);
}

.course-card:hover .course-card-arrow {
  transform: translateX(3px);
  color: var(--color-accent);
}

/* 囲い早見表 */
.castle-table-wrap {
  max-width: 680px;
  margin: 1.5rem auto 2rem;
  overflow-x: auto;
}

.castle-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.castle-table th,
.castle-table td {
  border: 1px solid var(--color-border);
  padding: 0.45rem 0.7rem;
  text-align: center;
}

.castle-table th {
  background: var(--color-hover);
  font-weight: 700;
}

.castle-table td:first-child {
  text-align: left;
  font-weight: 700;
}

.castle-table td:nth-child(2) {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.stars-gold { color: #A0712A; }
.rec-great  { color: var(--color-accent); font-weight: 700; }
.rec-good   { color: var(--color-text); }
.rec-ok     { color: var(--color-text-muted); }

/* 各ステップの本文 */
.guide-body {
  max-width: var(--read-width);
  margin: 0 auto;
}

.guide-body h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 2.5rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--color-border);
}

.guide-body .castle-entry h2 {
  margin-bottom: 0.4rem;
}

.guide-body h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.8rem 0 0.6rem;
}

.guide-body p {
  line-height: 1.85;
  margin-bottom: 1rem;
}

.guide-body ul {
  margin: 0.5rem 0 1rem 1.4rem;
  line-height: 1.85;
}

.guide-body li {
  margin-bottom: 0.4rem;
}

.guide-value-table {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 1rem 0;
  font-size: 1rem;
  font-weight: 700;
}

.guide-value-table .piece {
  padding: 0.2rem 0.7rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.guide-value-table .arrow {
  color: var(--color-text-muted);
  font-size: 1.1rem;
}

.design-note {
  border-left: 3px solid var(--color-accent);
  padding: 0.15rem 0 0.15rem 1rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.95rem;
}

.series-note {
  font-size: 0.83rem;
  color: var(--color-text-muted);
  border-left: 3px solid var(--color-border);
  padding: 0.1rem 0 0.1rem 1rem;
  margin: 1rem 0 1.5rem;
  line-height: 1.7;
}

.summary-box {
  background: var(--color-tint);
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
}

.summary-box h3 {
  margin-top: 0;
  font-size: 1rem;
}

.summary-box p {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.summary-box p:last-child {
  margin-bottom: 0;
}

.summary-box ul {
  margin: 0.4rem 0 0 1.2rem;
}

/* ステップ表示（1 — 2 — 3） */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
}

.step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  color: var(--color-text-muted);
}

.step-dot:hover {
  text-decoration: none;
}

.step-dot-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  transition: background 0.15s, border-color 0.15s;
}

.step-dot.is-current .step-dot-circle {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-bg);
}

.step-dot.is-current .step-dot-label {
  color: var(--color-text);
  font-weight: 700;
}

.step-dot.is-done .step-dot-circle {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.step-dot:hover:not(.is-current) .step-dot-circle {
  border-color: var(--color-accent);
}

.step-dot-label {
  font-size: 0.7rem;
  white-space: nowrap;
}

.step-line {
  flex: 1;
  max-width: 80px;
  height: 2px;
  background: var(--color-border);
  margin: 0 0.4rem 1.4rem;
}

/* 前後のステップへのナビ */
.course-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
  max-width: var(--read-width);
}

.course-nav-btn {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
  color: var(--color-text);
  flex: 1;
  max-width: 300px;
}

.course-nav-btn:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.course-nav-btn.is-next {
  text-align: right;
  margin-left: auto;
}

.course-nav-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 0.2rem;
}

.course-nav-title {
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.4;
}

/* ========================================
   Glossary page
   ======================================== */
.glossary-index,
.glossary-list {
  max-width: var(--read-width);
  margin-left: auto;
  margin-right: auto;
}

.glossary-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  margin-bottom: 2.5rem;
}

.glossary-index a {
  font-size: 0.85rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  transition: background 0.15s;
}

.glossary-index a:hover {
  background: var(--color-hover);
  text-decoration: none;
}

.glossary-italic-note {
  max-width: var(--read-width);
  margin: 0 auto 2rem;
  font-size: 0.88rem;
  color: var(--color-text-muted);
  padding: 0.7rem 1rem;
  background: var(--color-tint);
}

.glossary-list {
  display: flex;
  flex-direction: column;
}

.glossary-item {
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--color-border);
}

.glossary-item:first-child {
  border-top: 1px solid var(--color-border);
}

.glossary-term {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--color-text);
}

.glossary-term a {
  color: inherit;
  text-decoration: none;
}

.glossary-def {
  margin: 0;
  line-height: 1.75;
}

.glossary-def ul {
  margin: 0.5rem 0 0 1.2rem;
  padding: 0;
}

.glossary-def li {
  margin-bottom: 0.25rem;
}

.glossary-note {
  margin-top: 0.6rem;
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

/* ========================================
   Glossary inline links
   ======================================== */
.glossary-link {
  border-bottom: 1px dotted var(--color-text-muted);
  text-decoration: none;
  color: inherit;
}
.glossary-link:hover {
  border-bottom: 1px solid var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
}

/* ========================================
   Link Card (OGP preview) — 本の紹介枠
   ======================================== */
.link-card {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem;
  margin: 1.5rem 0;
  color: var(--color-text);
  background: var(--color-tint);
  text-decoration: none !important;
}

.link-card:hover .link-card-title {
  color: var(--color-accent);
}

.link-card-thumb {
  width: 96px;
  flex-shrink: 0;
  overflow: hidden;
  align-self: flex-start;
}

.link-card-thumb img {
  width: 100%;
  height: auto;
  display: block;
}

.link-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  justify-content: center;
}

.link-card-body p,
.article-body .link-card-body p {
  margin: 0;
}

.link-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.55;
  margin: 0;
  transition: color 0.15s;
}

.link-card-desc {
  font-size: 0.84rem;
  color: var(--color-text-muted);
  line-height: 1.75;
  margin: 0;
}

.link-card-host {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--color-accent);
  margin: 0;
}

.link-card-host::after {
  content: " \2192";
}

@media (max-width: 480px) {
  .link-card-thumb {
    width: 72px;
  }
}

/* ガイド・囲いページ末尾の本の紹介 */
.book-promo {
  max-width: var(--read-width);
  margin: 3.5rem auto 0;
}

.book-promo-lead {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0;
  font-size: 0.88rem;
  color: var(--color-text-muted);
  text-decoration: none;
}

.btn-ghost:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.obfuscated-email {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.copy-email-btn {
  margin-left: 0.45rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  line-height: 1.4;
  cursor: pointer;
}

.copy-email-btn:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.btn-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 0;
  text-decoration: none;
  flex: 1 1 240px;
}

.btn-nav:hover {
  text-decoration: none;
}

.btn-nav-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1;
}

.btn-nav-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.6;
  transition: color 0.15s;
}

.btn-nav:hover .btn-nav-title {
  color: var(--color-accent);
}

.article-body blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 0.2rem 0 0.2rem 1.25rem;
  margin: 2rem 0;
  color: var(--color-text);
}

.article-body blockquote p {
  margin-bottom: 0;
}

.article-body a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.article-body a.glossary-link {
  color: inherit;
  text-decoration: none;
}

.article-body code {
  background: var(--color-tint);
  padding: 0.1em 0.4em;
  font-size: 0.88em;
}

.article-body .note {
  background: var(--color-tint);
  padding: 1rem 1.25rem;
  margin: 1.75rem 0;
  font-size: 0.95rem;
}

.article-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 0 2rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.article-footer .btn-ghost {
  flex-basis: 100%;
}

/* ========================================
   Back to Top Button
   ======================================== */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
  z-index: 100;
}

.back-to-top.is-visible {
  opacity: 0.9;
  visibility: visible;
}

.back-to-top:hover {
  opacity: 1;
  background: var(--color-text);
  color: var(--color-bg);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1000px) {
  /* ヘッダーが2段になり高さが変わるので固定をやめる（本の紹介の目次バーとの重なり防止） */
  .site-header {
    position: static;
  }

  .books-nav {
    top: 0;
  }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }

  .site-nav {
    gap: 0.4rem 1rem;
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .post-card.has-thumb {
    flex-direction: column;
  }

  .post-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  .book-hero-inner,
  .book-intro {
    grid-template-columns: 1fr;
  }

  .book-cover-wrap {
    max-width: 170px;
  }

  .hero {
    padding: 2.75rem 0 2.25rem;
  }

  .hero-shelf {
    padding: 2.75rem 0 2.5rem;
  }

  .shelf-text {
    margin-bottom: 2.25rem;
  }

  .hero-shelf {
    --label-h: 1.1rem;
    --label-gap: 1.1rem;
    --plank-h: 10px;
  }

  .shelf-label {
    font-size: 0.68rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }

  .books-grid {
    grid-template-columns: 1fr;
  }

  .related-books {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 2.5rem 0;
  }

  .book-section {
    padding: 2rem 0;
  }

  .book-page-section {
    padding: 2.5rem 0;
  }

  .article-body {
    font-size: 1rem;
  }

  .lang-btn {
    min-width: 140px;
    padding: 1.25rem 2rem;
  }
}

/* ========================================
   無料ツール（/ja/tools/, /en/tools/）
   ======================================== */
.tool-row:first-child {
  padding-top: 0.5rem;
}

.tool-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
  padding: 2.75rem 0;
  border-bottom: 1px solid var(--color-border);
}

.tool-shot {
  display: block;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: border-color 0.15s;
}

.tool-shot:hover {
  border-color: var(--color-text-muted);
}

.tool-shot img {
  width: 100%;
  height: auto;
}

.tool-body h2 {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.4rem;
}

.tool-lead {
  color: var(--color-text-muted);
  margin-bottom: 1.1rem;
}

.tool-body .styled-list {
  margin-bottom: 1rem;
}

.tool-note {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-bottom: 1.4rem;
}

.tool-sample {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
  max-width: 820px;
  margin: 3.5rem auto 0;
}

.tool-sample img {
  width: 100%;
  height: auto;
  border: 1px solid var(--color-border);
}

.tool-sample figcaption {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.8;
}

.tool-sample figcaption strong {
  display: block;
  color: var(--color-text);
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

.tool-sample figcaption a {
  display: table;
  margin-top: 0.4rem;
  font-weight: 700;
}

.tool-sample figcaption a::after {
  content: " \2192";
}

@media (max-width: 768px) {
  .tool-row,
  .tool-sample {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

  .tool-sample {
    max-width: 420px;
  }
}


/* Link to the author's personal blog, distinct from the portal's blog. */
.author-blog-link {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
}

.gate-footer .author-blog-link a {
  color: var(--wall-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Imported blog articles retain their diagrams and book links. */
.article-body img { max-width:100%; height:auto; }
.article-body figure { margin:1.5rem 0; }
.article-body figcaption { font-size:.875rem; color:var(--text-muted,#666); }
.article-body .article-book-card { display:grid; grid-template-columns:88px minmax(0,1fr); gap:1rem; padding:1rem; border:1px solid #ded8cc; border-radius:8px; align-items:center; }
.article-body .article-book-cover img { width:88px; height:132px; object-fit:contain; }
.article-body .article-book-title { font-weight:bold; margin:0 0 .5rem; }
.article-body .note-embed-link { padding:1rem; border:1px solid #ded8cc; border-radius:8px; margin:1rem 0; overflow-wrap:anywhere; }
.article-body table { display:block; max-width:100%; overflow-x:auto; }
.article-body pre { overflow-x:auto; }

/* Recommended books directory */
.recommended-books { max-width: 840px; padding-top: 2rem; padding-bottom: 3rem; }
.recommended-intro p + p { margin-top: 1rem; }
.recommended-nav { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; margin: 2rem 0; padding: 1rem 0; border-block: 1px solid var(--color-border); }
.recommended-section h2 { scroll-margin-top: 7rem; margin: 2.5rem 0 1rem; }
.recommended-book { padding: 1.5rem 0; border-bottom: 1px solid var(--color-border); }
.recommended-book h3 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.recommended-book p { margin-bottom: 0.75rem; }
.recommended-audience { font-weight: 700; }
.recommended-book a { display: inline-block; padding: 0.5rem 0; text-decoration: underline; text-underline-offset: 3px; }
.recommended-own { margin-top: 2rem; }

/* Illustrated introduction to shogi */
.rules-start { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin: 1.5rem 0; padding: 1.25rem 1.5rem; background: var(--color-tint); border-left: 3px solid var(--color-accent); }
.rules-start strong { font-size: 1.15rem; }
.rules-start p { margin: 0.25rem 0 0; }
.rules-start > a { font-weight: 700; text-decoration: underline; text-underline-offset: 4px; padding: 0.5rem 0; }
.rules-eyebrow { margin-bottom: 0.5rem; color: var(--color-accent); font-weight: 700; }
.rules-guide { max-width: 820px; padding-top: 2rem; padding-bottom: 4rem; line-height: 1.85; }
.rules-guide p, .rules-guide ul { margin: 0 0 1rem; }
.rules-guide ul, .rules-guide ol { padding-left: 1.5rem; }
.rules-guide li + li { margin-top: 0.5rem; }
.rules-guide h2 { font-size: clamp(1.4rem, 4vw, 1.8rem); margin: 3rem 0 1rem; scroll-margin-top: 10rem; }
.rules-guide h3 { margin: 1.5rem 0 0.75rem; font-size: 1.15rem; }
.rules-guide a { text-decoration: underline; text-underline-offset: 3px; }
.rules-toc { margin: 2rem 0; padding: 1.25rem 1.5rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; }
.rules-toc ol { margin-top: 0.75rem; }
.rules-guide figure { margin: 1.5rem auto; max-width: 600px; }
.rules-guide figure img { display: block; width: 100%; height: auto; background: white; border: 1px solid var(--color-border); border-radius: 6px; }
.rules-guide figcaption { margin-top: 0.5rem; font-size: 0.9rem; color: var(--color-text-muted); line-height: 1.6; }
.rules-table-wrap { overflow-x: auto; margin: 1.5rem 0; }
.rules-guide table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.rules-guide caption { text-align: left; font-weight: 700; margin-bottom: 0.5rem; }
.rules-guide th, .rules-guide td { padding: 0.75rem; border-bottom: 1px solid var(--color-border); text-align: left; vertical-align: top; }
.rules-guide thead { background: var(--color-tint); }
.rules-guide th[scope="row"] { min-width: 6rem; }
.rules-guide details { margin: 1.25rem 0; padding: 1rem 1.25rem; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); }
.rules-guide summary { cursor: pointer; font-weight: 700; }
.rules-guide details[open] summary { margin-bottom: 1rem; }
.rules-guide details p:last-child { margin-bottom: 0; }
.rules-diagram-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.rules-diagram-pair figure { min-width: 0; }
.rules-next { display: grid; gap: 1rem; }
.rules-next a { display: block; padding: 1.25rem; border: 1px solid var(--color-border); border-radius: 8px; text-decoration: none; }
.rules-next a:hover { background: var(--color-tint); }
.rules-next span { display: block; margin-top: 0.4rem; color: var(--color-text); }
.rules-piece-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0; }
.rules-piece { min-width: 0; padding: 1rem; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); }
.rules-piece h3 { margin: 0 0 0.5rem; }
.rules-piece svg { display: block; width: 100%; max-width: 200px; margin: 0 auto 0.75rem; }
.rules-piece p { margin-bottom: 0; }
.rules-guide :focus-visible, .rules-start a:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 4px; }
@media (max-width: 600px) {
  .rules-piece-grid { grid-template-columns: 1fr; }
  .rules-diagram-pair { grid-template-columns: 1fr; gap: 0; }
  .rules-guide th, .rules-guide td { padding: 0.5rem; }
}

/* =========================================================
   次の一手問題（ja/problems/）
   ========================================================= */
.problem-number {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 0.2rem;
}

.problem-answer {
  margin-top: 2.5rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.problem-answer > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.9rem 1.2rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-accent);
}

.problem-answer > summary::-webkit-details-marker {
  display: none;
}

.problem-answer > summary::after {
  content: " ▼";
  font-size: 0.8em;
}

.problem-answer[open] > summary {
  border-bottom: 1px solid var(--color-border);
}

.problem-answer[open] > summary::after {
  content: " ▲";
}

.problem-answer-body {
  padding: 0.5rem 1.2rem 1.5rem;
}

.problem-hint + .problem-answer {
  margin-top: 1rem;
}

.problem-hint .problem-answer-body {
  padding-bottom: 0.5rem;
}

.problem-card-thumb {
  flex-shrink: 0;
  width: 280px;
  height: auto;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #fff;
}

@media (max-width: 640px) {
  .problem-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }

  .problem-card-thumb {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
  }

  .problem-card .course-card-arrow {
    display: none;
  }
}

/* 将棋の問題：一覧のフィルタ */
.problem-filter {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.problem-filter[hidden],
.problem-filter-empty[hidden],
.course-card[hidden] {
  display: none;
}

.problem-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.problem-filter-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-muted);
  min-width: 4.5em;
}

.problem-filter-chip {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
}

.problem-filter-chip:hover {
  background: var(--color-hover);
}

.problem-filter-chip[aria-pressed="true"] {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.problem-filter-chip:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.problem-filter-empty {
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}
