.wr-sidepanel-card {
  display: flex;
  flex-direction: column;
}

.wr-chapter-actions {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid #edf1f4;
}

.wr-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #d8e1e7;
  border-radius: 19px;
  background: #fff;
  color: #42505b;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease, background-color .18s ease;
}

.wr-action-btn:hover {
  border-color: #1f9f88;
  color: #1f9f88;
  background: #f4fbf9;
}

.wr-action-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.wr-control-groups {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

.wr-side-share {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wr-side-share > span {
  margin-right: auto;
  color: #73808c;
  font-size: 13px;
}

.wr-side-share {
  width: 100%;
  min-width: 0;
  gap: 5px;
  padding-top: 4px;
}

.wr-share-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  box-sizing: border-box;
  border-radius: 50%;
  color: #fff;
  transition: opacity .18s ease, transform .18s ease;
}

.wr-side-share .wr-share-link {
  width: 28px;
  height: 28px;
}

.wr-share-link:hover {
  color: #fff;
  opacity: .84;
  transform: translateY(-1px);
}

.wr-share-link svg {
  width: 16px;
  height: 16px;
}

.wr-share-x {
  background: #161616;
}

.wr-share-x svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.wr-share-facebook {
  background: #1877f2;
}

.wr-share-facebook svg,
.wr-share-telegram svg {
  fill: currentColor;
}

.wr-share-telegram {
  background: #229ed9;
}

.wr-action-btn:focus-visible,
.wr-share-link:focus-visible,
.wr-dialog-close:focus-visible,
.wr-chapter-dialog textarea:focus-visible,
.wr-report-footer button:focus-visible {
  outline: 3px solid rgba(31, 159, 136, .28);
  outline-offset: 2px;
}

.reader-body[data-reader-theme="dark"] .wr-chapter-actions {
  border-bottom-color: rgba(255, 255, 255, .07);
}

.reader-body[data-reader-theme="dark"] .wr-action-btn {
  border-color: rgba(255, 255, 255, .08);
  background: #2a3139;
  color: #d4dbe1;
}

.reader-body[data-reader-theme="dark"] .wr-action-btn:hover {
  border-color: #6fd8c4;
  color: #6fd8c4;
}

.reader-body[data-reader-theme="dark"] .wr-side-share > span {
  color: #a8b2bb;
}

.wr-chapter-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 20px;
  background: rgba(16, 25, 32, .62);
}

.wr-chapter-modal.is-open {
  display: flex;
}

body.wr-modal-open {
  overflow: hidden;
}

.wr-chapter-dialog {
  position: relative;
  box-sizing: border-box;
  width: min(460px, 100%);
  padding: 24px;
  border: 1px solid #d8e1e7;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 22px 64px rgba(21, 37, 49, .26);
  color: #26323c;
}

.wr-chapter-dialog h2 {
  margin: 0 38px 18px 0;
  font-size: 20px;
  line-height: 1.4;
}

.wr-dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #edf2f4;
  color: #57636f;
  font-size: 24px;
  line-height: 30px;
  cursor: pointer;
}

.wr-chapter-dialog label {
  display: block;
  margin-bottom: 8px;
  color: #57636f;
  font-size: 14px;
}

.wr-chapter-dialog textarea {
  display: block;
  width: 100%;
  min-height: 130px;
  box-sizing: border-box;
  padding: 11px 12px;
  border: 1px solid #cbd7df;
  border-radius: 8px;
  background: #f8fafb;
  color: #26323c;
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
}

.wr-report-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.wr-report-footer p {
  margin: 0;
  color: #73808c;
  font-size: 13px;
}

.wr-report-footer p.is-error {
  color: #bd3d3d;
}

.wr-report-footer button {
  flex: 0 0 auto;
  min-width: 82px;
  padding: 9px 18px;
  border: 1px solid #1f9f88;
  border-radius: 20px;
  background: #1f9f88;
  color: #fff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.wr-report-footer button:disabled {
  cursor: wait;
  opacity: .65;
}

.wr-qr-dialog {
  width: min(390px, 100%);
  padding: 0;
  overflow: hidden;
  text-align: center;
}

.wr-qr-dialog h2 {
  margin: 0;
  padding: 18px 54px 18px 22px;
  background: #1f9f88;
  color: #fff;
  font-weight: 500;
  text-align: left;
}

.wr-qr-dialog .wr-dialog-close {
  top: 13px;
  right: 14px;
  background: transparent;
  color: #fff;
}

.wr-qr-content {
  padding: 22px;
}

.wr-qr-code {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 196px;
  height: 196px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 8px;
  border: 1px solid #e1e7eb;
  border-radius: 8px;
  background: #fff;
}

.wr-qr-code img,
.wr-qr-code canvas,
.wr-qr-code table {
  display: block;
  max-width: 180px;
  max-height: 180px;
}

.wr-qr-content p {
  margin: 14px 0 0;
  color: #73808c;
  font-size: 14px;
}

@media (max-width: 900px) {
  .wr-desktop-action {
    display: none;
  }

  .wr-chapter-actions {
    grid-template-columns: minmax(110px, 160px) 1fr;
    align-items: center;
  }

  .wr-control-groups {
    flex: none;
  }
}

@media (max-width: 560px) {
  .wr-chapter-actions {
    grid-template-columns: 1fr;
  }

  .wr-report-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .wr-report-footer button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wr-action-btn,
  .wr-share-link {
    transition: none;
  }
}
