.public-reader-actions {
  font-family: inherit;
  margin: 0 0 0.85rem 0;
  padding: 0 0 0.85rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.public-reader-actions--floating {
  position: fixed;
  right: 1rem;
  top: 0.75rem;
  z-index: 2000;
  margin: 0;
  padding: 0;
  border-bottom: 0;
}

#quarto-margin-sidebar #TOC #toc-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

#quarto-margin-sidebar #TOC.public-reader-toc-collapsed > ul {
  display: none;
}

.public-reader-toc-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #94a3b8;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
}

.public-reader-toc-toggle:hover,
.public-reader-toc-toggle:focus {
  background: #f1f5f9;
  color: #334155;
}

.public-reader-format-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: inherit;
  margin: 0 0.75rem 0.85rem 0;
  padding: 0 0 0.85rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.public-reader-format-actions .book-narration-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  flex: 0 0 auto;
  margin: 0;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
}

.public-reader-format-actions .book-narration-launcher:hover,
.public-reader-format-actions .book-narration-launcher:focus {
  background: #e2e8f0;
  color: #0f172a;
}

#quarto-sidebar .book-narration.public-reader-narration-panel {
  margin: -0.35rem 0.75rem 0.85rem 0;
  padding: 0 0 0.85rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.public-reader-narration-start {
  position: fixed;
  z-index: 2050;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #2563eb;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
}

.public-reader-narration-start:hover,
.public-reader-narration-start:focus {
  background: #dbeafe;
  color: #1d4ed8;
}

.public-reader-narration-start[hidden] {
  display: none;
}

body.public-reader--narration-disabled .book-narration-launcher,
body.public-reader--narration-disabled .book-narration.public-reader-narration-panel,
body.public-reader--narration-disabled .public-reader-narration-start {
  display: none !important;
}

main.content .public-reader-narration-hover {
  background: linear-gradient(90deg, rgba(219, 234, 254, 0.52), rgba(219, 234, 254, 0.14));
  border-radius: 0.4rem;
  box-shadow: -0.35rem 0 0 rgba(37, 99, 235, 0.16);
  transition: background 120ms ease, box-shadow 120ms ease;
}

body.public-reader--narration-disabled main.content .public-reader-narration-hover,
body.public-reader--narration-disabled main.content .book-narration__active {
  background: transparent;
  box-shadow: none;
}

.public-reader-actions__format {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(75, 85, 99, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
  padding: 0.12rem;
  backdrop-filter: blur(10px);
}

.public-reader-actions__format-button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #4b5563;
  padding: 0.22rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.public-reader-actions__format-button--active {
  background: #1f2937;
  color: #fff;
}

.public-reader-actions__tts-toggle {
  flex: 0 0 auto;
  min-width: 2.65rem;
  height: 2rem;
  border: 1px solid rgba(75, 85, 99, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #64748b;
  padding: 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(10px);
}

.public-reader-actions__tts-toggle:hover,
.public-reader-actions__tts-toggle:focus {
  background: #e2e8f0;
  color: #0f172a;
}

.public-reader-actions__tts-toggle--active {
  border-color: rgba(37, 99, 235, 0.45);
  background: #2563eb;
  color: #fff;
}

.public-reader-actions__tts-toggle--active:hover,
.public-reader-actions__tts-toggle--active:focus {
  background: #1d4ed8;
  color: #fff;
}

.public-reader-actions__copy-wrap {
  position: relative;
}

.public-reader-actions__split {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid rgba(75, 85, 99, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}

.public-reader-actions__copy,
.public-reader-actions__toggle {
  border: 0;
  background: transparent;
  color: #1f2937;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 400;
}

.public-reader-actions__copy {
  border-right: 1px solid rgba(75, 85, 99, 0.2);
}

.public-reader-actions__toggle {
  padding-inline: 0.55rem;
}

.public-reader-actions__copy:hover,
.public-reader-actions__toggle:hover {
  background: #eef2ff;
}

.public-reader-actions__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 14rem;
  border: 1px solid rgba(75, 85, 99, 0.25);
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  padding: 0.35rem;
}

.public-reader-actions__menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #1f2937;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
}

.public-reader-actions__menu button:hover {
  background: #eef2ff;
}

.public-reader-markdown {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(15, 23, 42, 0.48);
  padding: 2rem;
}

.public-reader-markdown-view {
  min-height: 0;
  padding: 0;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 32rem),
    #f8fafc;
  color: #111827;
}

.public-reader-markdown-view__page {
  max-width: min(960px, 100%);
  margin: 0 auto;
  border: 1px solid #d8dee9;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.public-reader-markdown-view__source {
  margin: 0;
  padding: 1.25rem;
  color: #111827;
  font: 0.9rem/1.62 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.public-reader-markdown-view__line {
  min-height: 1.62em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scroll-margin-top: 4rem;
}

.public-reader-markdown-view__line--heading {
  color: #0f172a;
  font-weight: 700;
}

.public-reader-markdown-toc--level-3 {
  padding-left: 0.75rem;
}

.public-reader-markdown-toc--level-4,
.public-reader-markdown-toc--level-5,
.public-reader-markdown-toc--level-6 {
  padding-left: 1.25rem;
}

.public-reader-lightbox__trigger {
  cursor: zoom-in;
}

.public-reader-lightbox__trigger:hover {
  filter: contrast(1.02) saturate(1.04);
}

.public-reader-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vh, 2rem) clamp(0.75rem, 2vw, 1.5rem);
  background: rgba(3, 7, 18, 0.88);
  box-sizing: border-box;
  overflow: hidden;
}

.public-reader-lightbox[hidden] {
  display: none;
}

.public-reader-lightbox img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - clamp(1.5rem, 4vw, 3rem));
  max-height: calc(100dvh - clamp(2rem, 6vh, 4rem));
  object-fit: contain;
  border-radius: 0.75rem;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
}

.public-reader-lightbox__close {
  position: fixed;
  right: 1rem;
  top: 0.85rem;
  z-index: 1;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 1.45rem;
  line-height: 1;
}

body.public-reader--lightbox {
  overflow: hidden;
}

.public-reader-markdown__panel {
  max-width: min(980px, 96vw);
  max-height: 90vh;
  margin: 0 auto;
  background: #fff;
  color: #111827;
  border-radius: 1rem;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.public-reader-markdown__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.85rem 1rem;
}

.public-reader-markdown__header h2 {
  margin: 0;
  font-size: 1rem;
}

.public-reader-markdown__header button {
  border: 0;
  background: transparent;
  color: #111827;
  font-size: 1.5rem;
  line-height: 1;
}

.public-reader-markdown pre {
  margin: 0;
  padding: 1rem;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.86rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .public-reader-actions--floating {
    top: 0.38rem;
    right: 0.62rem;
  }

  .public-reader-actions__copy {
    max-width: 4.1rem;
    padding-inline: 0.58rem;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0;
  }

  .public-reader-actions__copy::before {
    content: "Copy";
    font-size: 0.78rem;
  }

  .public-reader-actions__toggle {
    padding-inline: 0.46rem;
  }

  .public-reader-actions__menu {
    max-width: calc(100vw - 1.25rem);
    min-width: 12rem;
  }

  main.content table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    white-space: normal;
  }

  main.content table th,
  main.content table td {
    min-width: 9rem;
  }
}
