:root {
  --reader-rail-width: 19rem;
  --reader-rail-gap: 1rem;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  height: 100%;
  width: min(calc(100% - 2rem), var(--page-width));
  margin: 0 auto;
  padding: 0;
}

#reader-app-root {
  display: contents;
}

.book-reading-layout {
  display: block;
}

.book-reading-layout.has-desktop-rail {
  padding-right: calc(var(--reader-rail-width) + var(--reader-rail-gap));
}

.book-enrichment-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  opacity: 0.7;
  transition:
    opacity 140ms ease,
    color 140ms ease;
}

.book-enrichment-toggle::before {
  position: absolute;
  inset: 0.08rem;
  border-radius: 999px;
  background: rgba(171, 136, 80, 0);
  box-shadow: inset 0 0 0 1px rgba(124, 78, 29, 0);
  content: "";
  transition:
    background-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
  transform: scale(0.86);
}

.book-enrichment-toggle:hover,
.book-enrichment-toggle:focus-visible {
  color: var(--ink);
  opacity: 1;
}

.book-enrichment-toggle:hover::before,
.book-enrichment-toggle:focus-visible::before {
  background: rgba(255, 250, 239, 0.52);
  box-shadow: inset 0 0 0 1px rgba(70, 49, 21, 0.16);
  transform: scale(1);
}

.book-enrichment-toggle.is-active {
  color: var(--ink);
  opacity: 1;
}

.book-enrichment-toggle.is-active::before {
  background: rgba(171, 136, 80, 0.16);
  box-shadow: inset 0 0 0 1px rgba(124, 78, 29, 0.2);
  transform: scale(1);
}

.book-enrichment-toggle-icon {
  position: relative;
  z-index: 1;
  display: block;
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.book-enrichment-desktop-launcher {
  position: fixed;
  z-index: 50;
}

.book-enrichment-desktop-launcher {
  top: calc(var(--topbar-height) + 0.75rem);
  right: 0.5rem;
  z-index: 18;
}

.book-enrichment-anchor {
  border-radius: 0.16rem;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
}

.book-enrichment-anchor:hover,
.book-enrichment-anchor:focus-visible {
  color: rgba(92, 56, 19, 0.98);
}

.book-enrichment-anchor.is-dimmed,
.book-enrichment-anchor.is-active {
  background: rgba(171, 136, 80, 0.16);
  box-shadow: inset 0 -1px 0 rgba(124, 78, 29, 0.28);
  color: inherit;
}

.book-enrichment-surface {
  color: var(--ink);
}

.book-enrichment-desktop-rail {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  z-index: 18;
  width: min(var(--reader-rail-width), 100vw);
  height: calc(100dvh - var(--topbar-height));
  border-left: 1px solid rgba(70, 49, 21, 0.18);
  background: rgba(244, 236, 216, 0.36);
  box-shadow: -10px 0 28px rgba(44, 30, 15, 0.04);
}

.book-enrichment-surface-body {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.book-enrichment-desktop-rail .book-enrichment-surface-body {
  background: rgba(244, 236, 216, 0.36);
}

.book-enrichment-head {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  min-height: 2.5rem;
  padding: 0 0.8rem 0 1rem;
  border-bottom: 1px solid rgba(70, 49, 21, 0.16);
  background:
    linear-gradient(rgba(246, 239, 223, 0.96), rgba(244, 236, 216, 0.94));
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 rgba(255, 250, 239, 0.52);
}

.book-enrichment-head-kicker {
  margin: 0;
  display: flex;
  align-items: center;
  min-height: 2.5rem;
  line-height: 1;
}

.book-enrichment-head-actions {
  display: flex;
  align-items: center;
  min-height: 2.5rem;
  flex: 0 0 auto;
  gap: 0.2rem;
}

.book-enrichment-list {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.book-enrichment-card {
  position: absolute;
  left: 1rem;
  right: 1rem;
  margin: 0;
  padding: 0.9rem 0.9rem 0.95rem;
  border: 1px solid rgba(70, 49, 21, 0.18);
  border-radius: 0.55rem;
  background: rgba(250, 245, 232, 0.94);
  box-shadow: 0 10px 24px rgba(44, 30, 15, 0.05);
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.book-enrichment-card:hover,
.book-enrichment-card:focus-visible,
.book-enrichment-card.is-active {
  background: rgba(255, 251, 241, 0.98);
  border-color: rgba(124, 78, 29, 0.3);
  box-shadow: 0 14px 30px rgba(44, 30, 15, 0.08);
}

.book-enrichment-card.is-active {
  z-index: 2;
}

.book-enrichment-card--image {
  padding: 0.55rem 0.55rem 0.8rem;
}

.book-enrichment-card--footnote {
  padding: 1.15rem 1.2rem;
}

.book-enrichment-card--simple {
  display: flex;
  align-items: flex-start;
}

.book-enrichment-card--image .book-enrichment-preview {
  margin: 0;
}

.book-enrichment-image-caption {
  margin: 0.7rem 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
  font-style: italic;
  line-height: 1.35;
  text-align: center;
}

.book-enrichment-kicker {
  margin: 0 0 0.42rem;
  color: var(--ink-soft);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.book-enrichment-type {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.45rem;
  color: var(--ink-soft);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.book-enrichment-type-icon {
  display: inline-flex;
  width: 0.88rem;
  height: 0.88rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

.book-enrichment-icon {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.book-enrichment-quote {
  margin: 0 0 0.75rem;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.42;
}

.book-enrichment-quote::before {
  content: "“";
}

.book-enrichment-quote::after {
  content: "”";
}

.book-enrichment-preview {
  margin: 0 0 0.8rem;
  border: 1px solid rgba(70, 49, 21, 0.22);
  overflow: hidden;
  background: rgba(248, 241, 227, 0.88);
}

.book-enrichment-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.book-enrichment-footnote-content {
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.55;
}

.book-enrichment-footnote-content img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 0.9rem;
  border-radius: 0.35rem;
}

.book-enrichment-footnote-content p {
  margin: 0;
}

.book-enrichment-footnote-content a {
  color: rgba(92, 56, 19, 0.98);
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

.book-enrichment-footnote-content a:hover,
.book-enrichment-footnote-content a:focus-visible {
  color: rgba(124, 78, 29, 1);
}

.book-enrichment-preview--placeholder,
.book-enrichment-preview-placeholder {
  height: 9.2rem;
  background:
    linear-gradient(180deg, rgba(115, 89, 48, 0.12), rgba(115, 89, 48, 0.05)),
    linear-gradient(135deg, #d7c198, #eee0c4);
}

.book-enrichment-preview--scene {
  position: relative;
}

.book-enrichment-preview-badge {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  padding: 0.18rem 0.42rem;
  background: rgba(36, 24, 14, 0.82);
  color: rgba(255, 249, 237, 0.94);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

.book-enrichment-title {
  margin: 0 0 0.45rem;
  font-size: 1.02rem;
}

.book-enrichment-body {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.book-enrichment-location {
  margin: 0.75rem 0 0;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

@media (max-width: 72rem) {
  :root {
    --reader-rail-width: 18rem;
  }

  .book-enrichment-head,
  .book-enrichment-list {
    padding-inline: 0.85rem;
  }

  .book-enrichment-list {
    padding-top: 1.2rem;
  }

  .book-enrichment-card {
    padding-left: 0.72rem;
  }
}

@media (max-width: 64rem) {
  .book-reading-layout.has-desktop-rail {
    padding-right: 0;
  }

  .book-enrichment-desktop-rail,
  .book-enrichment-desktop-launcher {
    display: none;
  }

  .book-enrichment-anchor,
  .book-enrichment-anchor:hover,
  .book-enrichment-anchor:focus-visible,
  .book-enrichment-anchor.is-dimmed,
  .book-enrichment-anchor.is-active {
    background: transparent;
    box-shadow: none;
    color: inherit;
    cursor: text;
  }
}
