:root {
  color-scheme: dark;
  --reader-bg: #0b1118;
  --reader-surface: #101923;
  --reader-surface-2: #142131;
  --reader-text: #e7edf4;
  --reader-muted: #9daabc;
  --reader-faint: #6f8197;
  --reader-accent: #4da3ff;
  --reader-accent-2: #68d39b;
  --reader-border: #26384a;
  --reader-border-soft: rgba(129, 164, 204, .18);
  --reader-shadow: 0 18px 40px rgba(0, 0, 0, .32);
  --reader-header-height: 58px;
  --reader-sticky-top: var(--reader-header-height);
  --reader-mobile-status-height: 42px;
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  background: var(--reader-bg);
}

body {
  background:
    radial-gradient(circle at 70% -10%, rgba(77, 163, 255, .10), transparent 32rem),
    linear-gradient(180deg, #0b1118 0%, #091017 100%);
  color: var(--reader-text);
  font-size: 18px;
  line-height: 1.86;
  font-feature-settings: "palt" 1;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.quarto-light,
body.quarto-dark {
  background-color: var(--reader-bg);
  color: var(--reader-text);
}

a {
  color: var(--reader-accent);
  text-underline-offset: .18em;
}

a:hover,
a:focus {
  color: #9dccff;
}

.navbar {
  height: var(--reader-header-height);
  min-height: var(--reader-header-height);
  padding-block: .4rem;
  flex-wrap: nowrap;
  background: rgba(11, 17, 24, .88) !important;
  border-bottom: 1px solid var(--reader-border-soft);
  backdrop-filter: blur(18px);
  box-shadow: none;
  transition: transform .18s ease;
}

body.reader-reading .navbar:not(:focus-within) {
  transform: translateY(-100%);
}

.navbar-title {
  color: var(--reader-text);
  font-weight: 700;
  letter-spacing: 0;
}

.navbar .nav-link,
.navbar .navbar-brand,
.navbar .quarto-navigation-tool {
  color: var(--reader-muted) !important;
}

.navbar .nav-link:hover,
.navbar .nav-link.active,
.navbar .quarto-navigation-tool:hover {
  color: var(--reader-text) !important;
}

.aa-DetachedSearchButton {
  min-height: 44px;
  color: var(--reader-text) !important;
  background: rgba(16, 25, 35, .84) !important;
  border: 1px solid var(--reader-border) !important;
}

#quarto-content {
  background: transparent;
  overflow-x: clip;
}

main.content {
  width: min(100%, 860px);
  max-width: 860px;
  min-width: 0;
  padding-top: 1.35rem;
  padding-bottom: 8rem;
  overflow-x: clip;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--reader-text);
  font-family: "BIZ UDPMincho", "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-weight: 700;
  line-height: 1.34;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  line-break: anywhere;
  scroll-margin-top: 136px;
}

main.content section[id] {
  scroll-margin-top: 136px;
}

h1 {
  margin: 1rem 0 .6rem;
  font-size: clamp(2rem, 6vw, 3.2rem);
}

h2 {
  position: relative;
  margin-top: 2.7rem;
  padding-top: .2rem;
  padding-left: 1.05rem;
  font-size: clamp(1.55rem, 4.7vw, 2.25rem);
  border-top: 1px solid var(--reader-border);
}

h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: .45rem;
  width: 4px;
  height: 1.35em;
  border-radius: 999px;
  background: linear-gradient(180deg, #4da3ff, #68d39b);
}

h3 {
  margin-top: 2rem;
  color: #dce8f6;
  font-size: clamp(1.22rem, 3.7vw, 1.55rem);
}

h4 {
  margin-top: 1.6rem;
  color: #c8d7e8;
  font-size: 1.08rem;
}

p, li, dd, td, th {
  overflow-wrap: break-word;
}

p {
  margin-bottom: 1.18rem;
}

strong {
  color: #f5f8fb;
}

hr {
  border-color: var(--reader-border);
  opacity: 1;
}

blockquote {
  margin: 1.35rem 0;
  padding: .95rem 1rem .95rem 1.05rem;
  color: #c9d8e8;
  background: linear-gradient(90deg, rgba(77, 163, 255, .13), rgba(77, 163, 255, .04));
  border-left: 4px solid var(--reader-accent);
  border-radius: 0 8px 8px 0;
}

blockquote strong:first-child {
  color: #9dccff;
}

code {
  color: #b7d8ff;
  background: rgba(77, 163, 255, .10);
  border: 1px solid rgba(77, 163, 255, .15);
  border-radius: 5px;
}

pre {
  overflow-x: auto;
  color: #dce8f6;
  background: #081019 !important;
  border: 1px solid var(--reader-border);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

pre code {
  white-space: pre;
  overflow-wrap: normal;
  background: transparent;
  border: 0;
}

table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1.35rem 0;
  overflow-x: auto;
  border-color: var(--reader-border);
}

th, td {
  color: var(--reader-text);
  border-color: var(--reader-border) !important;
}

thead th {
  color: #f3f7fb;
  background: rgba(77, 163, 255, .09);
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

p:has(> img),
figure {
  max-width: 100%;
  overflow-x: auto;
}

figure img,
p > img {
  background: #f7fbff;
}

figcaption,
.figure-caption {
  color: var(--reader-muted);
  font-size: .92rem;
  line-height: 1.65;
}

.math.display,
mjx-container[jax="CHTML"][display="true"] {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: .55rem 0 .65rem;
}

mjx-container {
  color: var(--reader-text);
}

.page-columns .content {
  grid-column: body-content-start / body-content-end;
}

#quarto-sidebar {
  background: rgba(13, 23, 34, .92);
  border-right: 1px solid var(--reader-border-soft);
  backdrop-filter: blur(16px);
}

#quarto-sidebar .sidebar-title,
#quarto-sidebar a,
#quarto-sidebar .sidebar-item-text {
  color: var(--reader-muted);
}

#quarto-sidebar .sidebar-link.active,
#quarto-sidebar .sidebar-link:hover {
  color: var(--reader-text);
  background: rgba(77, 163, 255, .11);
  border-radius: 8px;
}

#quarto-margin-sidebar {
  display: none;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.book-card {
  padding: 1.15rem 1.2rem;
  background: linear-gradient(180deg, rgba(20, 33, 49, .86), rgba(16, 25, 35, .86));
  border: 1px solid var(--reader-border);
  border-radius: 10px;
  box-shadow: var(--reader-shadow);
}

.book-card h3 {
  margin-top: 0;
  font-size: 1.25rem;
}

.book-card p {
  margin-bottom: .8rem;
  color: #cbd8e6;
}

.reader-progress {
  position: fixed;
  top: var(--reader-sticky-top);
  left: 0;
  z-index: 1045;
  width: 100%;
  height: 2px;
  background: rgba(77, 163, 255, .12);
  transition: top .18s ease;
}

.reader-progress__bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #4da3ff, #68d39b);
  box-shadow: 0 0 18px rgba(77, 163, 255, .45);
}

.reader-mobile-status {
  position: sticky;
  top: var(--reader-sticky-top);
  z-index: 1040;
  display: none;
  height: var(--reader-mobile-status-height);
  min-height: var(--reader-mobile-status-height);
  padding: .42rem 1rem .32rem;
  background: rgba(11, 17, 24, .94);
  border-bottom: 1px solid var(--reader-border-soft);
  backdrop-filter: blur(18px);
  transition: top .14s ease;
}

.reader-mobile-status__section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  line-height: 1.35;
}

.reader-mobile-status__section {
  color: var(--reader-text);
  font-size: .84rem;
  font-weight: 700;
}

.reader-mobile-status__section .reader-current-section {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-mobile-status__percent {
  flex: 0 0 auto;
  color: #9dccff;
  font-variant-numeric: tabular-nums;
}

.reader-mobile-status__meter,
.reader-rail__meter {
  height: 5px;
  overflow: hidden;
  background: rgba(157, 170, 188, .18);
  border-radius: 999px;
}

.reader-mobile-status__meter {
  height: 2px;
  margin-top: .28rem;
}

.reader-mobile-status__meter span,
.reader-rail__meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #4da3ff, #68d39b);
  border-radius: inherit;
}

.reader-rail {
  position: fixed;
  top: calc(var(--reader-sticky-top) + 1.4rem);
  right: max(1.25rem, calc((100vw - 1500px) / 2 + 1rem));
  z-index: 20;
  width: 220px;
  padding: .78rem;
  background: rgba(16, 25, 35, .72);
  border: 1px solid var(--reader-border-soft);
  border-radius: 12px;
  box-shadow: var(--reader-shadow);
  backdrop-filter: blur(18px);
  transition: top .18s ease;
}

.reader-rail__label {
  color: var(--reader-faint);
  font-size: .76rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.reader-rail__chapter {
  display: block;
  margin-top: .35rem;
  color: var(--reader-text);
  font-weight: 700;
  line-height: 1.45;
}

.reader-rail__section {
  margin-top: .25rem;
  color: var(--reader-muted);
  font-size: .9rem;
  line-height: 1.45;
}

.reader-rail__meter {
  margin: .6rem 0 .22rem;
}

.reader-rail__percent {
  color: var(--reader-muted);
  font-size: .82rem;
  text-align: right;
}

.reader-rail__links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .45rem;
  margin-top: .7rem;
}

.reader-rail__links a {
  display: block;
  padding: .48rem .55rem;
  color: var(--reader-text);
  font-size: .82rem;
  line-height: 1.3;
  text-decoration: none;
  background: rgba(20, 33, 49, .72);
  border: 1px solid var(--reader-border);
  border-radius: 9px;
}

.reader-rail__links a span {
  display: block;
  color: var(--reader-faint);
  font-size: .72rem;
}

.reader-bottom-nav {
  position: fixed;
  right: auto;
  bottom: max(.65rem, env(safe-area-inset-bottom));
  left: 50%;
  width: min(calc(100% - 1.5rem), 560px);
  transform: translateX(-50%);
  z-index: 1050;
  display: none;
  grid-template-columns: 1fr auto 1fr;
  grid-template-columns: minmax(0, 1fr) 62px minmax(0, 1fr);
  gap: .4rem;
  padding: .36rem;
  background: rgba(11, 17, 24, .92);
  border: 1px solid var(--reader-border-soft);
  border-radius: 15px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .48);
  backdrop-filter: blur(20px);
}

.reader-bottom-nav a,
.reader-bottom-nav > span,
.reader-bottom-nav button {
  min-height: 46px;
  color: var(--reader-text);
  font: inherit;
  font-size: .8rem;
  line-height: 1.25;
  text-decoration: none;
  background: rgba(20, 33, 49, .82);
  border: 1px solid var(--reader-border);
  border-radius: 10px;
}

.reader-bottom-nav a,
.reader-bottom-nav > span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .42rem;
  justify-content: center;
  padding: .32rem .52rem;
}

.reader-bottom-nav .is-disabled {
  color: var(--reader-faint);
  background: rgba(20, 33, 49, .38);
  border: 1px solid rgba(38, 56, 74, .55);
}

.reader-bottom-nav a > span,
.reader-bottom-nav > span > span {
  color: var(--reader-muted);
  font-size: 1rem;
}

.reader-bottom-nav strong {
  display: block;
  overflow: hidden;
  color: var(--reader-text);
  font-size: .75rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-bottom-nav__toc {
  width: 62px;
}

.reader-bottom-nav__next {
  grid-template-columns: minmax(0, 1fr) auto !important;
  text-align: right;
}

.reader-bottom-nav__next > span {
  grid-column: 2;
  grid-row: 1;
}

.reader-bottom-nav__next > strong {
  grid-column: 1;
  grid-row: 1;
}

.reader-toc-sheet {
  position: fixed;
  inset: auto .65rem max(.65rem, env(safe-area-inset-bottom)) .65rem;
  z-index: 1060;
  display: none;
  max-height: min(74vh, 620px);
  overflow: hidden;
  background: rgba(13, 23, 34, .98);
  border: 1px solid var(--reader-border);
  border-radius: 18px;
  box-shadow: 0 28px 60px rgba(0, 0, 0, .58);
}

body.reader-reading {
  --reader-sticky-top: 0px;
}

body.reader-toc-open {
  overflow: hidden;
}

.reader-toc-sheet.is-open {
  display: block;
}

.reader-toc-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--reader-border-soft);
}

.reader-toc-sheet__title {
  color: var(--reader-text);
  font-weight: 700;
}

.reader-toc-sheet__close {
  min-width: 44px;
  min-height: 44px;
  color: var(--reader-text);
  background: rgba(20, 33, 49, .82);
  border: 1px solid var(--reader-border);
  border-radius: 12px;
}

.reader-toc-sheet__body {
  max-height: calc(min(74vh, 620px) - 74px);
  padding: .65rem 1rem 1rem;
  overflow: auto;
}

.reader-toc-sheet a {
  display: block;
  padding: .58rem .25rem;
  color: #d8e5f4;
  line-height: 1.45;
  text-decoration: none;
  border-bottom: 1px solid rgba(129, 164, 204, .10);
}

.reader-toc-sheet a.is-active {
  color: #9dccff;
}

.reader-toc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1055;
  display: none;
  background: rgba(0, 0, 0, .45);
}

.reader-toc-backdrop.is-open {
  display: block;
}

*:focus-visible {
  outline: 2px solid var(--reader-accent);
  outline-offset: 3px;
}

@media (max-width: 1280px) {
  .reader-rail {
    display: none;
  }
}

@media (max-width: 991.98px) {
  :root {
    --reader-header-height: 56px;
    --reader-mobile-status-height: 42px;
  }

  body {
    font-size: 17.5px;
    line-height: 1.82;
  }

  body.reader-ui {
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }

  .navbar {
    height: var(--reader-header-height);
    min-height: var(--reader-header-height);
    padding: .35rem .75rem;
  }

  .navbar .navbar-collapse {
    background: rgba(11, 17, 24, .98);
    border-bottom: 1px solid var(--reader-border);
  }

  .reader-mobile-status,
  .reader-bottom-nav {
    display: grid;
  }

  .reader-progress {
    display: none;
  }

  main.content {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: .8rem 16px 5.4rem !important;
    box-sizing: border-box;
  }

  #quarto-content {
    display: block !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
  }

  #quarto-document-content,
  main.content > * {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  main.content > *,
  main.content section > * {
    width: 100% !important;
    max-width: 100% !important;
  }

  main.content section,
  main.content p,
  main.content blockquote,
  main.content div:not(.reader-toc-sheet):not(.reader-bottom-nav) {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  main.content section {
    overflow-x: clip;
  }

  .quarto-figure,
  .quarto-figure-center,
  figure,
  p:has(> img),
  .math.display,
  mjx-container[jax="CHTML"][display="true"],
  table,
  pre {
    overflow-x: auto;
  }

  main.content h1,
  main.content h2,
  main.content h3,
  main.content h4,
  main.content p,
  main.content li,
  main.content blockquote {
    max-inline-size: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: auto-phrase;
  }

  #quarto-sidebar,
  #quarto-margin-sidebar,
  .quarto-secondary-nav,
  .quarto-sidebar-toggle,
  .quarto-btn-toggle,
  .sidebar-menu-container > .sidebar-title,
  .page-navigation {
    display: none !important;
  }

  h1 {
    margin-top: .85rem;
    font-size: clamp(1.42rem, 5.8vw, 1.72rem);
  }

  h2 {
    margin-top: 1.85rem;
    padding-left: .9rem;
    font-size: clamp(1.22rem, 4.8vw, 1.44rem);
  }

  h3 {
    margin-top: 1.65rem;
    font-size: clamp(1.08rem, 4.45vw, 1.26rem);
  }

  p, li {
    line-height: 1.82;
  }

  blockquote {
    margin: 1rem 0;
    padding: .72rem .82rem;
  }

  pre {
    margin-inline: 0;
  }

  h1, h2, h3, h4, h5, h6,
  main.content section[id] {
    scroll-margin-top: 58px;
  }

  body.reader-reading h1,
  body.reader-reading h2,
  body.reader-reading h3,
  body.reader-reading h4,
  body.reader-reading h5,
  body.reader-reading h6,
  body.reader-reading main.content section[id] {
    scroll-margin-top: 50px;
  }

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

  .book-card {
    padding: 1rem;
    box-shadow: none;
  }
}

@media (max-width: 374px) {
  main.content {
    padding-inline: 14px;
  }

  body {
    font-size: 17px;
  }

  .reader-bottom-nav {
    width: calc(100% - .9rem);
    gap: .35rem;
  }

  .reader-bottom-nav__toc {
    width: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .navbar,
  .reader-progress,
  .reader-mobile-status {
    transition: none;
  }
}
