.book-page {
  --feedback-context-flash-duration: 615ms;
  --feedback-context-flash-accent: rgba(255, 128, 64, 0.95);
  --feedback-context-flash-accent-soft: rgba(255, 128, 64, 0.16);
}

.hero-card {
  background: linear-gradient(135deg, #f8fbff 0%, #eef5ff 100%);
}

.admin-feedback-reactions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.75rem;
}

.admin-feedback-reaction {
  background: #fbfbff;
}

.admin-feedback-context {
  border-left: 0.25rem solid #8b5cf6;
  margin-left: 0;
  padding-left: 1rem;
  color: #495057;
}

.admin-feedback-stat {
  min-width: 7rem;
}

.book-column {
  position: relative;
  max-width: 70ch;
  margin-inline: auto;
}

body.toc2 .book-column {
  margin-left: 0;
  margin-right: auto;
}

.book-body {
  overflow-wrap: anywhere;
}

.book-body > #content {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.book-body > #content > .sect1:first-child > h2:first-child,
.book-body > #content > h1:first-child,
.book-body > #content > h2:first-child,
.book-body > h1:first-child {
  margin-top: 0 !important;
}

.book-body img,
.book-body svg,
.book-body video,
.book-body iframe {
  max-width: 100%;
}

.book-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.feedback-card {
  position: relative;
  padding-right: 4.75rem !important;
  background: #fff;
}

.feedback-list {
  position: relative;
}

.feedback-thread {
  --feedback-reply-connector-color: var(--bs-border-color, #dee2e6);
  --feedback-reply-branch-indent: 1.5rem;
  --feedback-reply-branch-joint-top: 1.25rem;
  display: grid;
  gap: 0.4rem;
}

.feedback-replies {
  position: relative;
  margin-left: var(--feedback-reply-branch-indent);
  display: grid;
  gap: 0.75rem;
}

.feedback-replies:empty {
  display: none;
}

.feedback-reply-branch::before {
  content: "";
  position: absolute;
  top: -0.75rem;
  left: calc(var(--feedback-reply-branch-indent) / -2);
  width: calc(var(--feedback-reply-branch-indent) / 2);
  height: calc(0.75rem + var(--feedback-reply-branch-joint-top));
  border-bottom: 2px solid var(--feedback-reply-connector-color);
  border-left: 2px solid var(--feedback-reply-connector-color);
  border-bottom-left-radius: 0.5rem;
  pointer-events: none;
}

.feedback-reply-branch:not(:last-child)::after {
  content: "";
  position: absolute;
  top: var(--feedback-reply-branch-joint-top);
  bottom: 0;
  left: calc(var(--feedback-reply-branch-indent) / -2);
  border-left: 2px solid var(--feedback-reply-connector-color);
  pointer-events: none;
}

.feedback-reply-card {
  position: relative;
  padding-right: 4.75rem !important;
  background: #fafafa;
  font-size: 0.925em;
}

.feedback-reply-form {
  margin-left: var(--feedback-reply-branch-indent);
  background: #fff;
}

.feedback-reply-button {
  justify-self: end;
  border-color: rgba(92, 74, 146, 0.35);
  background: #f7f5ff;
  color: #5c4a92;
  font-size: 0.8rem;
}

.feedback-reply-button:hover,
.feedback-reply-button:focus {
  border-color: rgba(92, 74, 146, 0.55);
  background: #efebff;
  color: #473875;
}

.feedback-reaction-detail {
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.65));
  font-size: 0.875em;
}

.feedback-card-context,
.feedback-highlight-context {
  animation-duration: var(--feedback-context-flash-duration);
  animation-iteration-count: infinite;
  animation-timing-function: step-end;
}

.feedback-card-context {
  animation-name: feedback-card-context-flash;
}

@keyframes feedback-card-context-flash {
  0%,
  100% {
    border-color: var(--feedback-context-flash-accent) !important;
    background: var(--feedback-context-flash-accent-soft);
  }

  50% {
    border-color: var(--bs-border-color) !important;
    background: #fff;
  }
}

.feedback-card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.feedback-card-top-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

.feedback-icon-button {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.feedback-context-link {
  position: absolute;
  width: 1.5rem;
  height: 1.5rem;
  right: 0.5rem;
  bottom: 0.5rem;
}

.feedback-context-link .lucide-icon {
  width: 0.8rem;
  height: 0.8rem;
}

.lucide-icon {
  width: 1rem;
  height: 1rem;
}

.feedback-delete-dialog {
  max-width: min(26rem, calc(100vw - 2rem));
  min-width: min(20rem, calc(100vw - 2rem));
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.24);
}

.feedback-delete-dialog::backdrop {
  background: rgba(33, 37, 41, 0.45);
}

.selection-toolbar {
  position: absolute;
  left: calc(100% + 0.75rem);
  z-index: 1080;
  padding: 0.5rem;
  border-radius: 1rem;
  background: rgba(33, 37, 41, 0.96);
}

.selection-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.selection-actions .btn {
  display: inline-flex;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
}

.selection-emoji-button {
  border-color: #8b5cf6;
  background: #e7ddff;
  color: #4c1d95;
}

.selection-emoji-button:hover,
.selection-emoji-button:focus-visible {
  border-color: #7c3aed;
  background: #ddd0ff;
  color: #3b0764;
}

.selection-comment-button {
  width: 2.45rem !important;
  height: 2.45rem !important;
  border: 2px solid #60a5fa;
  background: #eff6ff;
  color: #111827;
  font-size: 1.1rem;
  box-shadow:
    0 0 0 0.12rem rgba(96, 165, 250, 0.3),
    0 0.35rem 0.75rem rgba(15, 23, 42, 0.22);
}

.selection-comment-button:hover,
.selection-comment-button:focus-visible {
  border-color: #2563eb;
  background: #ffffff;
  color: #111827;
}

.selection-comment-form {
  width: min(18rem, calc(100vw - 2rem));
}

.book-body ::selection {
  background: rgba(84, 118, 255, 0.25);
}

.selection-highlight {
  border-radius: 0.2rem;
  background: rgba(84, 118, 255, 0.25);
}

.feedback-highlight {
  border-radius: 0.2rem;
  background: rgba(255, 225, 129, 0.7);
  cursor: pointer;
}

.feedback-highlight-context {
  animation-name: feedback-highlight-context-flash;
}

@keyframes feedback-highlight-context-flash {
  0%,
  100% {
    background: var(--feedback-context-flash-accent);
  }

  50% {
    background: rgba(255, 225, 129, 0.7);
  }
}

main.container > #footer {
  margin-top: 1rem;
}

body.toc2 {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.toc2 main.container {
  padding-left: 16rem;
}

body.toc2.toc-right main.container {
  padding-left: 0;
  padding-right: 16rem;
}

body.toc2 #toc.toc2 {
  top: 4.25rem !important;
  height: calc(100vh - 4.25rem) !important;
}

@media screen and (min-width: 1280px) {
  body.toc2 main.container {
    padding-left: 21rem;
  }

  body.toc2.toc-right main.container {
    padding-left: 0;
    padding-right: 21rem;
  }
}

@media screen and (max-width: 1199.98px) {
  .selection-toolbar {
    right: 0;
    left: auto;
  }
}

@media screen and (max-width: 991.98px) {
  body.toc2 main.container,
  body.toc2.toc-right main.container {
    padding-left: var(--bs-gutter-x, 0.75rem);
    padding-right: var(--bs-gutter-x, 0.75rem);
  }

  body.toc2 #toc.toc2 {
    position: static !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    border-right-width: 0 !important;
    border-left-width: 0 !important;
    margin-bottom: 1.5rem;
  }
}
