.library-floating-actions {
  position: fixed;
  right: clamp(18px, 3vw, 34px);
  bottom: clamp(18px, 3vw, 34px);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border: 1.5px solid rgba(107, 79, 53, 0.72);
  border-radius: 16px 12px 18px 13px / 13px 17px 12px 16px;
  background: #fffdf8;
  box-shadow: 0 14px 30px rgba(72, 62, 48, 0.16);
  transform: rotate(-1deg);
}

.library-comment-fab,
.library-share-fab {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 11px 9px 12px 10px / 10px 12px 9px 11px;
  overflow: hidden;
  background: transparent;
  cursor: pointer;
  transition: transform 160ms ease;
}

.library-comment-fab:hover,
.library-share-fab:hover {
  transform: scale(1.08);
}

.library-share-fab {
  border-right: 1px solid rgba(107, 79, 53, 0.24);
}

.library-comment-fab-icon,
.library-share-fab-icon {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.library-comment-fab > span:not(.library-comment-fab-icon) {
  position: absolute;
  top: 4px;
  right: 3px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #1e8347;
  color: #fffdf8;
  font-size: 11px;
  font-weight: 900;
}

.library-share-toast {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: max-content;
  max-width: min(240px, calc(100vw - 44px));
  padding: 10px 13px;
  border: 1px solid rgba(30, 131, 71, 0.2);
  border-radius: 999px;
  background: #fffdf8;
  color: #1e8347;
  box-shadow: 0 14px 28px rgba(72, 62, 48, 0.14);
  font-size: 13px;
  font-weight: 800;
}

.library-copy-toast {
  position: fixed;
  left: 50%;
  bottom: calc(104px + env(safe-area-inset-bottom, 0px));
  z-index: 140;
  max-width: min(320px, calc(100vw - 40px));
  padding: 12px 16px 13px;
  border: 1.5px solid rgba(107, 79, 53, 0.34);
  border-radius: 13px 10px 14px 11px / 11px 14px 10px 13px;
  background: #fff7c8;
  color: #3f3730;
  box-shadow: 0 16px 32px rgba(72, 62, 48, 0.16);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px) rotate(-1deg);
  transition: opacity 160ms ease, transform 160ms ease;
}

.library-copy-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) rotate(-1deg);
}

.library-share-backdrop,
.library-comment-shell {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(26, 46, 20, 0.16);
}

.library-share-backdrop {
  display: grid;
  place-items: center;
  padding: 24px;
}

.library-share-modal,
.library-comment-panel {
  position: relative;
  border: 1.5px solid rgba(107, 79, 53, 0.32);
  background: #fffdf8;
  box-shadow: 0 22px 54px rgba(47, 35, 24, 0.2);
}

.library-share-modal {
  display: grid;
  gap: 22px;
  width: min(720px, calc(100vw - 32px));
  padding: clamp(24px, 4vw, 34px);
  border-radius: 18px 14px 20px 15px / 14px 19px 13px 18px;
  transform: rotate(-0.5deg);
}

.library-share-modal-head,
.library-comment-panel-head {
  display: grid;
  gap: 8px;
}

.library-share-modal-head h2,
.library-comment-panel-head h2 {
  margin: 0;
  color: #5f432b;
  font-size: 24px;
  line-height: 1.25;
}

.library-share-modal-head p,
.library-comment-panel-head p,
.library-comment-empty p,
.library-comment-item p,
.library-comment-answer p {
  margin: 0;
  color: #51483c;
  line-height: 1.55;
}

.library-share-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.library-share-option {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  width: 100%;
  min-height: 174px;
  padding: 22px 18px;
  border: 1px solid rgba(107, 79, 53, 0.24);
  border-radius: 14px 11px 15px 12px / 12px 15px 11px 14px;
  background: rgba(255, 252, 245, 0.78);
  color: #5f432b;
  text-align: center;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}

.library-share-option:hover {
  border-color: rgba(107, 79, 53, 0.48);
  transform: scale(1.02);
}

.library-share-option strong,
.library-share-option small {
  display: block;
  min-width: 0;
  width: 100%;
}

.library-share-option small {
  margin-top: 8px;
  overflow: hidden;
  color: #7b6d5d;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-share-option-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(107, 79, 53, 0.07);
}

.library-share-option-icon img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.library-mobile-close {
  display: none;
  justify-self: end;
  min-height: 34px;
  padding: 6px 12px;
  border: 1.5px solid rgba(107, 79, 53, 0.28);
  border-radius: 14px 11px 15px 12px / 12px 15px 11px 14px;
  background: rgba(255, 252, 245, 0.7);
  color: #6b4f35;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.library-comment-shell {
  display: flex;
  justify-content: flex-end;
  padding: 18px;
}

.library-comment-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 16px;
  width: min(520px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  padding: 24px;
  border-radius: 18px 14px 20px 15px / 14px 19px 13px 18px;
  overflow: hidden;
}

.library-comment-filter-row,
.library-comment-type-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.library-comment-filter-row button,
.library-comment-type-row button {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid rgba(107, 79, 53, 0.24);
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.72);
  color: #6b4f35;
  font-weight: 900;
  cursor: pointer;
}

.library-comment-filter-row button.active,
.library-comment-type-row button.active {
  border-color: rgba(30, 131, 71, 0.42);
  background: rgba(30, 131, 71, 0.1);
  color: #1e8347;
}

.library-comment-list {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.library-comment-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(107, 79, 53, 0.16);
  border-radius: 14px 11px 15px 12px / 12px 15px 11px 14px;
  background: rgba(255, 252, 245, 0.66);
}

.library-comment-item > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(30, 131, 71, 0.12);
  color: #1e8347;
  font-weight: 900;
}

.library-comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
  color: #7b6d5d;
  font-size: 12px;
  font-weight: 800;
}

.library-comment-meta strong {
  color: #1e8347;
  font-size: 14px;
}

.library-comment-meta em {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(107, 79, 53, 0.08);
  color: #6b4f35;
  font-style: normal;
}

.library-comment-answer {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid rgba(30, 131, 71, 0.45);
  background: rgba(30, 131, 71, 0.06);
}

.library-comment-answer strong {
  color: #1e8347;
}

.library-comment-empty {
  display: grid;
  gap: 8px;
  padding: 22px;
  border: 1px dashed rgba(107, 79, 53, 0.28);
  border-radius: 14px 11px 15px 12px / 12px 15px 11px 14px;
  text-align: center;
}

.library-comment-empty h3 {
  margin: 0;
  color: #5f432b;
}

.library-comment-loading {
  border-style: solid;
  background: rgba(255, 253, 248, 0.72);
}

.library-comment-form {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(107, 79, 53, 0.18);
}

.library-comment-form .field {
  display: grid;
  gap: 7px;
  color: #5f432b;
  font-size: 14px;
  font-weight: 900;
}

.library-comment-form textarea {
  width: 100%;
  min-height: 112px;
  padding: 13px 14px;
  border: 1px solid rgba(107, 79, 53, 0.24);
  border-radius: 12px;
  background: #fffdf8;
  color: #51483c;
  font: inherit;
  resize: vertical;
}

.library-comment-form .button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: #1e8347;
  color: #fffdf8;
  font-weight: 900;
  cursor: pointer;
}

[data-library-comment-widget] .notice {
  margin: 0;
  color: #1e8347;
  font-size: 13px;
  font-weight: 900;
}

body:has([data-library-comment-widget]) .comment-fab,
body:has([data-library-comment-widget]) .comment-panel {
  display: none !important;
}

@media (max-width: 640px) {
  :root {
    --paper-bg: url("/images/paper-background-desktop.jpg") !important;
    --paper-mobile: url("/images/paper-background-desktop.jpg") !important;
    --paper-size: 4240px 2828px !important;
  }

  body,
  .top-nav {
    background-image:
      linear-gradient(rgba(255, 252, 245, 0.18), rgba(255, 252, 245, 0.18)),
      url("/images/paper-background-desktop.jpg") !important;
    background-repeat: repeat, repeat !important;
    background-size: auto, 1413px 943px !important;
    background-position: top left, top left !important;
  }

  .footer {
    padding: 24px 0 calc(28px + env(safe-area-inset-bottom)) !important;
  }

  .footer-inner {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    text-align: center !important;
  }

  .footer-brand {
    justify-content: center !important;
    gap: 8px !important;
    font-size: 19px !important;
  }

  .footer-logo {
    width: 64px !important;
  }

  .footer-copy {
    max-width: 32rem !important;
    margin: 0 auto !important;
    font-size: 12.5px !important;
    line-height: 1.55 !important;
    text-align: center !important;
  }

  .footer-copy strong {
    font-size: 17px !important;
  }

  .footer-links {
    justify-content: center !important;
    gap: 10px 14px !important;
  }

  .footer-links a {
    gap: 5px !important;
    font-size: 17px !important;
  }

  .footer-link-icon {
    width: 19px !important;
    height: 19px !important;
  }

  .library-floating-actions {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .library-copy-toast {
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 34px);
    font-size: 14px;
  }

  .library-comment-fab,
  .library-share-fab {
    width: 46px;
    height: 46px;
  }

  .library-share-backdrop,
  .library-comment-shell {
    padding: 14px;
  }

  .library-mobile-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .library-share-options {
    grid-template-columns: 1fr;
  }

  .library-share-option {
    min-height: 132px;
  }

  .library-comment-panel {
    width: calc(100vw - 28px);
    max-height: calc(100vh - 28px);
    padding: 18px;
  }
}
