:root {
  color-scheme: light;
  --page: #f2f0ec;
  --surface: #ffffff;
  --surface-soft: #f8f7f4;
  --ink: #1c2024;
  --muted: #626b73;
  --line: #d5d8da;
  --primary: #8b2f24;
  --primary-hover: #6f2119;
  --secondary: #2f6267;
  --focus: #1769aa;
  --max-width: 1160px;
  font-family: "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  line-height: 1.65;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

img {
  max-width: 100%;
}

.site-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.site-header__inner,
.site-footer__inner,
.content {
  width: min(calc(100% - 40px), var(--max-width));
  margin-inline: auto;
}

.site-header__inner {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  color: var(--ink);
  font-size: 1.16rem;
  font-weight: 800;
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-nav a {
  min-height: 40px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: none;
}

.site-nav a[aria-current="page"],
.site-nav a:hover {
  color: var(--primary);
}

.content {
  flex: 1;
  padding-block: 36px 72px;
}

.page-heading {
  display: grid;
  max-width: 760px;
  gap: 10px;
  margin-bottom: 30px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.45rem);
  line-height: 1.3;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.eyebrow {
  margin: 0;
  color: var(--secondary);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.book-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.book-card__cover {
  display: block;
  min-height: 225px;
  background: #e5e7e8;
}

.book-card__cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.book-card__body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 20px;
}

.book-card h2 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.45;
}

.book-card h2 a {
  text-decoration: none;
}

.book-card h2 a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.book-byline,
.book-summary {
  margin: 0;
  color: var(--muted);
}

.book-summary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.label-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.label {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid #bec9cb;
  border-radius: 4px;
  background: #f1f7f7;
  color: #31585b;
  font-size: 0.78rem;
  font-weight: 800;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: auto;
}

.button,
.button-secondary {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 4px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button {
  background: var(--primary);
  color: #fff;
}

.button:hover {
  background: var(--primary-hover);
}

.button-secondary {
  border-color: #bb9c97;
  background: #fff;
  color: var(--primary);
}

.button-secondary:hover {
  border-color: var(--primary);
  background: #fff7f5;
}

.detail-header {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

.detail-cover {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.detail-cover img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: contain;
}

.detail-copy {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.detail-copy h1 {
  margin: 0;
  font-size: clamp(1.85rem, 4vw, 3rem);
  line-height: 1.3;
}

.detail-copy .description {
  max-width: 70ch;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.9;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 34px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.fact {
  min-width: 0;
  padding: 15px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.fact dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.fact dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.reader-content {
  width: min(calc(100% - 24px), 1440px);
  padding-top: 20px;
}

.reader-toolbar {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.reader-toolbar h1 {
  margin: 0;
  overflow: hidden;
  font-size: 1.15rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.25rem;
  cursor: pointer;
}

.reader-frame-shell {
  position: relative;
  height: calc(100dvh - 160px);
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.reader-frame-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  border: 0;
}

.reader-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.site-footer__inner {
  padding-block: 20px 34px;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer p {
  margin: 0;
}

.not-found {
  display: grid;
  max-width: 620px;
  gap: 18px;
}

.analytics-content {
  width: min(calc(100% - 40px), 1180px);
}

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

.analytics-table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.analytics-table th,
.analytics-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

.analytics-table thead th {
  background: #eef2f1;
  color: #334244;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.analytics-table th:first-child,
.analytics-table td:first-child {
  min-width: 240px;
  text-align: left;
}

.analytics-table tbody tr:last-child th,
.analytics-table tbody tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 900px) {
  .book-grid {
    grid-template-columns: 1fr;
  }

  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .site-header__inner,
  .site-footer__inner,
  .content {
    width: min(calc(100% - 24px), var(--max-width));
  }

  .site-header__inner {
    min-height: 58px;
  }

  .content {
    padding-block: 26px 52px;
  }

  .detail-header {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .detail-cover {
    width: min(230px, 70vw);
  }

  .reader-content {
    width: min(calc(100% - 12px), 1440px);
    padding-top: 10px;
  }

  .reader-frame-shell {
    height: calc(100dvh - 128px);
    min-height: 420px;
  }
}

@media (max-width: 480px) {
  .site-nav a {
    padding-inline: 6px;
    font-size: 0.86rem;
  }

  .book-card {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .book-card__body {
    gap: 9px;
    padding: 14px;
  }

  .book-card__cover {
    min-height: 168px;
  }

  .book-card h2 {
    font-size: 1.05rem;
  }

  .book-summary {
    display: none;
  }

  .book-card .button-row {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .book-card .button,
  .book-card .button-secondary {
    width: 100%;
    padding-inline: 6px;
    font-size: 0.82rem;
  }

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

  .reader-toolbar h1 {
    font-size: 1rem;
  }
}
