/*
 * Book swapping and the wish shelf (inc/swap-helpers.php,
 * inc/wish-helpers.php): chips, the listing form's sale/swap switch, the
 * offer dialog, the offer card in the chat, the profile's swap list, the
 * wish shelf and the home page's "perfect swap" strip.
 */

/* ---------------- Chips ---------------- */

.trade-chip {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 5px;
  line-height: 1;
  padding: 5px 10px;
  white-space: nowrap;
}

.trade-chip-swap {
  background: rgba(30,105,104,0.13);
  color: var(--book-teal);
}

.trade-chip-wish {
  background: var(--book-orange);
  color: #fff;
}

.trade-chip-warn {
  background: rgba(181,73,91,0.12);
  color: var(--book-danger);
}

/* On listing cards: over the cover, bottom left (the price sits right). */
.listing-trade-chips {
  bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  left: 8px;
  pointer-events: none;
  position: absolute;
}

.listing-trade-chips .trade-chip {
  box-shadow: 0 2px 8px rgba(23,25,29,0.18);
  font-size: 11px;
  padding: 4px 8px;
}

.listing-trade-chips .trade-chip-swap {
  background: var(--book-teal);
  color: #fff;
}

/* ---------------- Listing page ---------------- */

.item-detail-trade {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 4px;
}

.item-detail-wants {
  color: var(--book-muted);
  flex-basis: 100%;
  font-size: 14px;
  margin: 2px 0 0;
}

.item-detail-wants strong {
  color: var(--book-ink);
}

.item-detail-swap-value-label {
  color: var(--book-muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.item-detail-reserved-badge {
  background: var(--book-teal);
}

.item-swap-btn,
.item-detail-actions .item-swap-btn {
  align-items: center;
  background: rgba(30,105,104,0.12);
  border: 1px solid var(--book-teal);
  color: var(--book-teal);
  display: inline-flex;
  gap: 8px;
  justify-content: center;
}

.item-swap-btn:hover {
  background: var(--book-teal);
  color: #fff;
}

/* ---------------- Listing form: sale / swap / both ---------------- */

.trade-mode-toggle {
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--book-line);
  border-radius: 14px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 4px;
}

.trade-mode-option {
  cursor: pointer;
  margin: 0;
  position: relative;
}

.trade-mode-option input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.trade-mode-option span {
  align-items: center;
  border-radius: 10px;
  color: var(--book-muted);
  display: flex;
  font-size: 14px;
  font-weight: 800;
  gap: 7px;
  justify-content: center;
  padding: 10px 6px;
  transition: background 0.18s ease, color 0.18s ease;
}

.trade-mode-option input:checked + span {
  background: var(--book-ink);
  color: #fff;
}

.trade-mode-option input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(30,105,104,0.3);
}

.trade-mode-hint {
  margin: 8px 0 0;
  min-height: 1.4em;
}

.trade-wants {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.trade-wants[hidden] {
  display: none;
}

.trade-wants label {
  font-size: 14px;
  font-weight: 700;
}

.control-group-negotiable.is-swap-only {
  display: none;
}

/* Search filter: "Swap possible" */
.search-filter-check {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: 700;
  gap: 8px;
  margin: 12px 0 4px;
}

.search-filter-check input {
  accent-color: var(--book-teal);
  height: 18px;
  margin: 0;
  width: 18px;
}

.search-filter-check i {
  color: var(--book-teal);
}

/* ---------------- Buttons ---------------- */

.swap-btn {
  align-items: center;
  background: var(--book-panel-strong);
  border: 1px solid var(--book-line);
  border-radius: 10px;
  color: var(--book-ink);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  gap: 6px;
  justify-content: center;
  padding: 9px 12px;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.swap-btn:hover {
  border-color: var(--book-teal);
  color: var(--book-teal);
}

.swap-btn-primary {
  background: var(--book-teal);
  border-color: var(--book-teal);
  color: #fff;
}

.swap-btn-primary:hover {
  background: #17504f;
  color: #fff;
}

.swap-btn-ghost {
  background: transparent;
}

.swap-btn-link {
  background: none;
  border: 0;
  color: var(--book-muted);
  font-weight: 700;
  padding: 9px 4px;
  text-decoration: underline;
}

.swap-btn-link:hover {
  color: var(--book-danger);
}

/* Composer: the ⇄ button left of the message field */
.chat-swap-btn {
  align-items: center;
  background: rgba(30,105,104,0.1);
  border: 0;
  border-radius: 50%;
  color: var(--book-teal);
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  height: 34px;
  justify-content: center;
  margin-left: -10px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.2s ease;
  width: 34px;
}

.chat-swap-btn:hover {
  background: var(--book-teal);
  color: #fff;
  transform: rotate(180deg);
}

/* ---------------- Swap scale (card and dialog) ---------------- */

.swap-scale {
  background: rgba(23,25,29,0.04);
  border-radius: 12px;
  display: grid;
  gap: 7px;
  font-size: 13px;
  padding: 10px 12px;
}

.swap-scale-row {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

.swap-scale-note {
  color: var(--book-muted);
}

.swap-scale-bar {
  background: rgba(215,111,53,0.35);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  position: relative;
}

.swap-scale-bar i {
  background: var(--book-teal);
  border-radius: 999px;
  inset: 0 auto 0 0;
  position: absolute;
  transition: width 0.3s ease;
  width: 50%;
}

.swap-scale.is-uneven .swap-scale-row:first-child span {
  color: var(--book-orange);
  font-weight: 800;
}

/* ---------------- The offer card in the chat ---------------- */

.chat-bubble-row.swap-card-row {
  align-items: stretch;
}

.swap-card {
  background: var(--book-panel-strong);
  border: 1px solid var(--book-line);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(40,36,31,0.12);
  color: var(--book-ink);
  max-width: 440px;
  overflow: hidden;
  transition: opacity 0.2s ease;
  width: min(100%, 440px);
}

.swap-card.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

.swap-card.is-closed {
  opacity: 0.62;
}

.swap-card-head {
  align-items: center;
  background: rgba(30,105,104,0.13);
  color: var(--book-teal);
  display: flex;
  font-size: 12px;
  font-weight: 800;
  gap: 10px;
  justify-content: space-between;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  text-transform: uppercase;
}

.swap-card-status {
  letter-spacing: 0;
  opacity: 0.85;
  text-align: right;
  text-transform: none;
}

.swap-status-completed .swap-card-head {
  background: var(--book-teal);
  color: #fff;
}

.swap-status-disputed .swap-card-head {
  background: rgba(181,73,91,0.12);
  color: var(--book-danger);
}

.swap-card.is-closed .swap-card-head {
  background: rgba(23,25,29,0.06);
  color: var(--book-muted);
}

.swap-card-books {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  padding: 14px;
}

.swap-card-side {
  display: grid;
  gap: 6px;
  justify-items: center;
  min-width: 0;
  text-align: center;
}

.swap-card-side-label {
  color: var(--book-muted);
  font-size: 12px;
  font-weight: 700;
}

.swap-card-stack {
  display: flex;
  justify-content: center;
  min-height: 84px;
}

.swap-card-stack img {
  background: #fff;
  border-radius: 3px 7px 7px 3px;
  box-shadow: inset 4px 0 0 rgba(0,0,0,0.1), 0 6px 14px rgba(0,0,0,0.16);
  height: 84px;
  background-color: #f1ede7;
  object-fit: contain;
  width: 58px;
}

.swap-card-stack img + img {
  margin-left: -34px;
  transform: rotate(6deg);
}

.swap-card-stack img + img + img {
  transform: rotate(12deg);
}

.swap-card-titles {
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 2px;
  line-height: 1.3;
  list-style: none;
  margin: 0;
  max-width: 100%;
  padding: 0;
}

.swap-card-titles li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swap-card-titles a {
  color: inherit;
  text-decoration: none;
}

.swap-card-titles a:hover {
  color: var(--book-teal);
  text-decoration: underline;
}

.swap-card-value {
  color: var(--book-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.swap-card-arrow {
  align-self: center;
  color: var(--book-muted);
  font-size: 18px;
  padding-top: 18px;
}

.swap-card .swap-scale {
  margin: 0 14px;
}

.swap-card-foot {
  display: grid;
  gap: 10px;
  padding: 12px 14px 14px;
}

.swap-card-hint {
  color: var(--book-muted);
  font-size: 13px;
  margin: 0;
}

.swap-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swap-card-actions .swap-btn {
  flex: 1 1 auto;
}

.swap-card-actions .swap-btn-link {
  flex: 0 0 auto;
}

.swap-card-error {
  color: var(--book-error);
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

.swap-ship-form {
  display: flex;
  gap: 8px;
}

.swap-ship-form[hidden] {
  display: none;
}

.swap-ship-form input {
  border: 1px solid var(--book-line);
  border-radius: 10px;
  flex: 1;
  font: inherit;
  font-size: 14px;
  min-width: 0;
  padding: 8px 12px;
}

/* Progress once accepted */
.swap-timeline {
  display: grid;
  list-style: none;
  margin: 12px 14px 0;
  padding: 0;
}

.swap-timeline li {
  display: grid;
  gap: 10px;
  grid-template-columns: 24px minmax(0, 1fr);
  padding-bottom: 10px;
  position: relative;
}

.swap-timeline li::before {
  background: var(--book-line);
  bottom: 0;
  content: "";
  left: 11px;
  position: absolute;
  top: 22px;
  width: 2px;
}

.swap-timeline li:last-child::before {
  display: none;
}

.swap-timeline-dot {
  align-items: center;
  background: #fff;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--book-line);
  color: var(--book-muted);
  display: flex;
  font-size: 11px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  position: relative;
  width: 24px;
  z-index: 1;
}

.swap-timeline li.is-done .swap-timeline-dot {
  background: var(--book-teal);
  box-shadow: none;
  color: #fff;
}

.swap-timeline li.is-now .swap-timeline-dot {
  background: var(--book-orange);
  box-shadow: 0 0 0 4px rgba(215,111,53,0.2);
  color: #fff;
}

.swap-timeline-text {
  display: grid;
  font-size: 13px;
  line-height: 1.35;
  padding-top: 3px;
}

.swap-timeline-text small {
  color: var(--book-muted);
  font-size: 12px;
}

/* Status lines in the chat */
.chat-system-line {
  display: flex;
  justify-content: center;
  margin: 2px 0;
}

.chat-system-line span {
  background: rgba(30,105,104,0.1);
  border-radius: 12px;
  color: var(--book-teal);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  max-width: 85%;
  padding: 6px 14px;
  text-align: center;
}

/* ---------------- The offer dialog ---------------- */

html.swap-picker-open,
html.swap-picker-open body {
  overflow: hidden;
}

.swap-picker {
  align-items: center;
  background: rgba(23,25,29,0.45);
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 0;
  padding: 16px;
  position: fixed;
  transition: opacity 0.2s ease;
  z-index: 10050;
}

.swap-picker.is-open {
  opacity: 1;
}

.swap-picker-box {
  background: var(--book-bg);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(23,25,29,0.35);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  max-width: 760px;
  overflow: hidden;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.25s ease;
  width: 100%;
}

.swap-picker.is-open .swap-picker-box {
  transform: none;
}

.swap-picker-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 20px 22px 12px;
}

.swap-picker-head h2 {
  font-size: 22px;
  font-weight: 900;
  margin: 0;
}

.swap-picker-head p {
  color: var(--book-muted);
  margin: 2px 0 0;
}

.swap-picker-head a {
  color: var(--book-teal);
  font-weight: 800;
}

.swap-picker-close {
  align-items: center;
  background: var(--book-panel-strong);
  border: 0;
  border-radius: 50%;
  color: var(--book-ink);
  display: flex;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 16px;
  height: 36px;
  width: 36px;
}

.swap-picker-cols {
  align-content: start;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 0;
  overflow-y: auto;
  padding: 4px 22px 14px;
}

.swap-picker-col h3 {
  color: var(--book-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.swap-pick-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.swap-pick {
  align-items: center;
  background: var(--book-panel-strong);
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: 42px minmax(0, 1fr) 22px;
  margin: 0;
  padding: 8px 10px 8px 8px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.swap-pick input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.swap-pick img {
  border-radius: 3px 6px 6px 3px;
  height: 58px;
  background-color: #f1ede7;
  object-fit: contain;
  width: 42px;
}

.swap-pick-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.swap-pick-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swap-pick-meta,
.swap-pick-wants {
  color: var(--book-muted);
  font-size: 12px;
}

.swap-pick-wants {
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swap-pick-wish {
  color: var(--book-orange);
  font-size: 12px;
  font-weight: 800;
}

.swap-pick-check {
  align-items: center;
  border: 2px solid var(--book-line);
  border-radius: 50%;
  color: transparent;
  display: flex;
  font-size: 11px;
  height: 22px;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  width: 22px;
}

.swap-pick:has(input:checked) {
  background: #fff;
  border-color: var(--book-teal);
}

.swap-pick input:checked ~ .swap-pick-check {
  background: var(--book-teal);
  border-color: var(--book-teal);
  color: #fff;
}

.swap-pick input:focus-visible ~ .swap-pick-check {
  box-shadow: 0 0 0 3px rgba(30,105,104,0.3);
}

.swap-picker-empty {
  background: var(--book-panel);
  border-radius: 14px;
  color: var(--book-muted);
  font-size: 14px;
  margin: 0;
  padding: 14px;
}

.swap-picker-empty a {
  color: var(--book-teal);
  display: inline-block;
  font-weight: 800;
  margin-top: 6px;
}

.swap-picker-scale {
  margin: 0 22px;
}

.swap-topup {
  border-top: 1px solid var(--book-line);
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
  padding-top: 10px;
}

.swap-topup-title {
  font-size: 13px;
}

/* Who adds money: a segmented choice. */
.swap-topup-choice {
  background: rgba(23,25,29,0.05);
  border-radius: 12px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 4px;
}

.swap-topup-choice label {
  cursor: pointer;
  margin: 0;
  position: relative;
}

.swap-topup-choice input {
  opacity: 0;
  position: absolute;
}

.swap-topup-choice span {
  align-items: center;
  border-radius: 9px;
  color: var(--book-muted);
  display: flex;
  font-size: 13px;
  font-weight: 800;
  justify-content: center;
  line-height: 1.2;
  min-height: 36px;
  padding: 6px 8px;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.swap-topup-choice input:checked + span {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  color: var(--book-teal);
}

.swap-topup-choice input:focus-visible + span {
  outline: 2px solid var(--book-teal);
  outline-offset: 1px;
}

/* The amount only when someone pays. */
.swap-topup-amount {
  align-items: center;
  display: none;
  gap: 6px;
  margin: 0;
}

.swap-topup.has-payer .swap-topup-amount {
  display: flex;
}

.swap-topup input[name="topup"] {
  border: 1px solid var(--book-line);
  border-radius: 10px;
  font: inherit;
  font-weight: 800;
  padding: 7px 10px;
  text-align: right;
  width: 110px;
}

.swap-topup-amount span {
  color: var(--book-muted);
  font-weight: 800;
}

.swap-topup small {
  color: var(--book-muted);
}

.swap-handover {
  border: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 12px 22px 0;
  padding: 0;
}

.swap-handover legend {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 8px;
  padding: 0;
}

.swap-handover-option {
  cursor: pointer;
  margin: 0;
  position: relative;
}

.swap-handover-option input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.swap-handover-option span {
  align-items: center;
  background: var(--book-panel-strong);
  border: 2px solid transparent;
  border-radius: 12px;
  display: flex;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
  padding: 10px;
}

.swap-handover-option input:checked + span {
  border-color: var(--book-teal);
  color: var(--book-teal);
}

.swap-handover-option input:disabled + span {
  cursor: not-allowed;
  opacity: 0.45;
}

.swap-handover-note {
  color: var(--book-muted);
  font-size: 12px;
  grid-column: 1 / -1;
  margin: 0;
}

.swap-picker-foot {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 22px 20px;
}

.swap-picker-error {
  color: var(--book-error);
  flex-basis: 100%;
  font-weight: 700;
  margin: 0;
}

.swap-picker-send {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

@media (max-width: 640px) {
  .swap-picker {
    align-items: flex-end;
    padding: 0;
  }

  .swap-picker-box {
    border-radius: 22px 22px 0 0;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
  }

  /* The whole sheet scrolls; its parts keep their natural height. */
  .swap-picker-box > * {
    flex-shrink: 0;
  }

  .swap-picker-cols {
    overflow: visible;
  }

  .swap-picker-cols {
    grid-template-columns: minmax(0, 1fr);
  }

  .swap-picker-foot .btn {
    flex: 1;
  }
}

/* ---------------- Profile: my swaps ---------------- */

.swap-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.swap-list-row a {
  align-items: center;
  background: var(--book-panel-strong);
  border: 1px solid var(--book-line);
  border-radius: 14px;
  color: var(--book-ink);
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 10px 14px;
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.swap-list-row a:hover {
  border-color: var(--book-teal);
}

.swap-list-books {
  align-items: center;
  display: flex;
  gap: 4px;
}

.swap-list-books img {
  border-radius: 2px 5px 5px 2px;
  height: 44px;
  background-color: #f1ede7;
  object-fit: contain;
  width: 31px;
}

.swap-list-books i {
  color: var(--book-muted);
  font-size: 12px;
  margin: 0 3px;
}

.swap-list-info {
  display: grid;
  min-width: 0;
}

.swap-list-title {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swap-list-meta {
  color: var(--book-muted);
  font-size: 13px;
}

.swap-list-status {
  background: rgba(23,25,29,0.06);
  border-radius: 999px;
  color: var(--book-muted);
  font-size: 12px;
  font-weight: 800;
  padding: 5px 10px;
  white-space: nowrap;
}

.swap-list-status.needs-me {
  background: var(--book-orange);
  color: #fff;
}

.swap-list-row.swap-status-completed .swap-list-status {
  background: rgba(30,105,104,0.13);
  color: var(--book-teal);
}

.my-book-swapped {
  align-self: flex-start;
}

.public-profile-swaps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 6px 0 10px;
}

.review-swap-chip {
  font-size: 11px;
  padding: 3px 8px;
}

@media (max-width: 560px) {
  .swap-list-row a {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .swap-list-books {
    grid-column: 1 / -1;
  }
}

/* ---------------- Wish shelf ---------------- */

.wish-shelf-intro {
  color: var(--book-muted);
  margin: 0 0 14px;
  max-width: 62ch;
}

.wish-add {
  background: var(--book-panel-strong);
  border: 1px solid var(--book-line);
  border-radius: 16px;
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
}

.wish-add.is-busy {
  opacity: 0.7;
}

.wish-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wish-add-field {
  align-items: center;
  background: #fff;
  border: 1px solid var(--book-line);
  border-radius: 12px;
  display: flex;
  flex: 1 1 220px;
  gap: 10px;
  padding: 0 12px;
}

.wish-add-field:focus-within {
  border-color: var(--book-teal);
  box-shadow: 0 0 0 3px rgba(30,105,104,0.12);
}

.wish-add-field i {
  color: var(--book-muted);
}

.wish-add .wish-add-field input,
.wish-add .wish-add-field input:focus {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
  font: inherit;
  margin: 0;
  min-height: 44px;
  min-width: 0;
  outline: none;
  padding: 0;
}

.wish-add .wish-add-scan {
  border-radius: 12px;
  min-height: 46px;
}

.wish-add-submit {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.wish-add-manual-toggle {
  background: none;
  border: 0;
  color: var(--book-teal);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  justify-self: start;
  padding: 2px 0;
}

.wish-add-manual {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wish-add-manual[hidden] {
  display: none;
}

.wish-add-manual input {
  border: 1px solid var(--book-line);
  border-radius: 12px;
  font: inherit;
  min-width: 0;
  padding: 10px 12px;
}

.wish-add-status {
  color: var(--book-muted);
  font-size: 13px;
  margin: 0;
  min-height: 0;
}

.wish-add-status:empty {
  display: none;
}

.wish-add-status.is-error {
  color: var(--book-error);
  font-weight: 700;
}

.wish-shelf-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.wish-shelf-tools[hidden] {
  display: none;
}

.wish-shelf-tools .wish-filter {
  flex: 1 1 220px;
  margin: 0;
}

.wish-shelf-tools .my-books-search .wish-filter-input {
  min-height: 42px;
  text-align: left;
}

.wish-filter-fields {
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--book-line);
  border-radius: 999px;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
}

.wish-filter-fields button {
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--book-muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 6px 12px;
  transition: background 0.15s ease, color 0.15s ease;
}

.wish-filter-fields button.is-active {
  background: var(--book-ink);
  color: #fff;
}

/* The shelf: covers standing on a wooden board. */
.wish-shelf-row {
  border-bottom: 12px solid var(--book-tan);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 10px 18px -12px rgba(60,40,20,0.5);
  display: grid;
  gap: 20px 16px;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  list-style: none;
  margin: 0;
  padding: 6px 4px 14px;
}

.wish-book {
  display: grid;
  gap: 8px;
  grid-template-rows: auto 1fr;
  position: relative;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.wish-book[hidden] {
  display: none;
}

.wish-book.is-new {
  animation: wish-book-in 0.45s cubic-bezier(.2,.9,.3,1.3);
}

.wish-book.is-leaving {
  opacity: 0;
  transform: translateY(8px) scale(0.95);
}

@keyframes wish-book-in {
  from { opacity: 0; transform: translateY(-16px) rotate(-4deg); }
  to { opacity: 1; transform: none; }
}

/* A book on the shelf: its real cover, or — without one — a cover of its
   own that looks printed: cloth texture, a spine crease, a gold frame,
   the title set in a book serif and the author in small caps. */
.wish-book-cover {
  aspect-ratio: 2 / 3;
  background:
    linear-gradient(160deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 45%, rgba(0,0,0,0.22)),
    var(--spine, var(--book-teal));
  border-radius: 3px 8px 8px 3px;
  box-shadow:
    inset 7px 0 0 rgba(0,0,0,0.18),
    inset 8px 0 0 rgba(255,255,255,0.14),
    0 12px 22px -6px rgba(40,28,16,0.38);
  max-width: 100%;
  overflow: visible;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Cloth grain. */
.wish-book-cover::before {
  background: repeating-linear-gradient(45deg, rgba(255,255,255,0.035) 0 2px, transparent 2px 5px);
  border-radius: inherit;
  content: '';
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.wish-book:hover .wish-book-cover {
  transform: translateY(-4px) rotate(-1deg);
}

.wish-book-spine {
  align-items: center;
  color: #fff;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  overflow: hidden;
  padding: 24px 12px 14px 18px;
  position: relative;
  text-align: center;
}

/* The thin gold frame printed on the cover. */
.wish-book-spine::before {
  border: 1px solid rgba(255,226,170,0.55);
  border-radius: 2px;
  content: '';
  inset: 8px 7px 8px 14px;
  pointer-events: none;
  position: absolute;
}

.wish-book-cover-title {
  display: -webkit-box;
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  hyphens: auto;
  line-height: 1.18;
  margin-top: 10%;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

/* A small ornament between title and author. */
.wish-book-cover-title::after {
  background: rgba(255,226,170,0.7);
  content: '';
  display: block;
  height: 1px;
  margin: 9px auto 0;
  width: 22px;
}

.wish-book-cover-author {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  max-width: 100%;
  opacity: 0.88;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.wish-book-cover img {
  border-radius: 3px 8px 8px 3px;
  height: 100%;
  inset: 0;
  object-fit: cover;
  position: absolute;
  width: 100%;
  z-index: 1;
}

/* "Here!" — a bookmark ribbon hanging from the top edge. */
.wish-book-here {
  background: var(--book-orange);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  color: #fff;
  filter: drop-shadow(0 3px 4px rgba(150,60,20,0.35));
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  min-width: 30px;
  padding: 7px 6px 12px;
  position: absolute;
  right: 10px;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  top: -4px;
  white-space: nowrap;
  z-index: 2;
}

.wish-book.has-match .wish-book-cover {
  box-shadow:
    inset 7px 0 0 rgba(0,0,0,0.18),
    inset 8px 0 0 rgba(255,255,255,0.14),
    0 0 0 2px var(--book-panel-strong),
    0 0 0 4px var(--book-orange),
    0 12px 22px -6px rgba(40,28,16,0.38);
}

.wish-book-info {
  align-content: start;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.wish-book-title {
  display: -webkit-box;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.wish-book-author,
.wish-book-isbn {
  color: var(--book-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wish-book-isbn {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

/* Who has it: a small orange tag under the book. */
.wish-book-match {
  align-items: flex-start;
  background: rgba(215,111,53,0.1);
  border-radius: 8px;
  color: var(--book-orange);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  gap: 4px;
  justify-self: start;
  line-height: 1.3;
  margin-top: 5px;
  padding: 4px 8px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.wish-book-match:hover {
  background: rgba(215,111,53,0.18);
}

.wish-book-match span {
  background: var(--book-orange);
  border-radius: 999px;
  color: #fff;
  flex-shrink: 0;
  font-size: 10px;
  padding: 0 5px;
}

/* Remove: a small round button on the top left corner, on hover. */
.wish-book-remove {
  align-items: center;
  background: rgba(23,25,29,0.72);
  border: 2px solid var(--book-panel-strong);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 10px;
  height: 24px;
  justify-content: center;
  left: -8px;
  opacity: 0;
  position: absolute;
  top: -8px;
  transition: opacity 0.15s ease, background 0.15s ease;
  width: 24px;
  z-index: 3;
}

.wish-book-remove:hover {
  background: var(--book-danger);
}

.wish-book:hover .wish-book-remove,
.wish-book-remove:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .wish-book-remove {
    opacity: 1;
  }
}

.wish-shelf-empty,
.wish-filter-empty {
  color: var(--book-muted);
  margin: 14px 0 0;
}

@media (max-width: 560px) {
  .wish-shelf-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 12px;
  }

  .wish-book-spine {
    padding: 20px 8px 10px 13px;
  }

  .wish-book-spine::before {
    inset: 6px 5px 6px 11px;
  }

  .wish-book-cover-title {
    font-size: 12px;
  }

  .wish-book-cover-author {
    font-size: 8px;
    letter-spacing: 0.1em;
  }

  .wish-book-remove {
    font-size: 9px;
    height: 20px;
    left: -6px;
    top: -6px;
    width: 20px;
  }

  .wish-add-manual {
    grid-template-columns: 1fr;
  }
}

/* ---------------- Home: perfect swaps ---------------- */

.perfect-swaps {
  margin: 8px 0 28px;
}

.perfect-swaps-head {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-bottom: 12px;
}

.perfect-swaps-head h2 {
  font-size: 22px;
  font-weight: 900;
  margin: 0;
}

.perfect-swaps-head h2 i {
  color: var(--book-orange);
}

.perfect-swaps-head p {
  color: var(--book-muted);
  margin: 0;
}

.perfect-swaps-list {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.perfect-swap {
  align-items: start;
  background: var(--book-panel-strong);
  border: 1px solid var(--book-line);
  border-radius: 18px;
  box-shadow: var(--book-shadow);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  padding: 14px;
}

.perfect-swap-book {
  color: var(--book-ink);
  display: grid;
  font-size: 13px;
  font-weight: 800;
  gap: 6px;
  justify-items: center;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}

.perfect-swap-book img {
  border-radius: 3px 7px 7px 3px;
  box-shadow: inset 4px 0 0 rgba(0,0,0,0.1), 0 6px 14px rgba(0,0,0,0.16);
  height: 96px;
  background-color: #f1ede7;
  object-fit: contain;
  width: 66px;
}

.perfect-swap-arrow {
  align-self: center;
  color: var(--book-orange);
  font-size: 18px;
  margin-top: -20px;
}

.perfect-swap-foot {
  align-items: center;
  border-top: 1px solid var(--book-line);
  color: var(--book-muted);
  display: flex;
  font-size: 13px;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: space-between;
  padding-top: 10px;
}

/* Home: books from the wish shelf that have been listed */
.wish-arrivals-list {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.wish-arrival {
  align-items: center;
  background: var(--book-panel-strong);
  border: 1px solid var(--book-line);
  border-radius: 18px;
  box-shadow: var(--book-shadow);
  display: grid;
  gap: 10px 14px;
  grid-template-columns: 72px minmax(0, 1fr);
  padding: 14px;
}

.wish-arrival-cover {
  position: relative;
}

.wish-arrival-cover img {
  border-radius: 3px 7px 7px 3px;
  box-shadow: inset 4px 0 0 rgba(0,0,0,0.1), 0 6px 14px rgba(0,0,0,0.16);
  display: block;
  height: 104px;
  background-color: #f1ede7;
  object-fit: contain;
  width: 72px;
}

.wish-arrival-cover .trade-chip {
  bottom: -8px;
  font-size: 10px;
  left: 50%;
  padding: 3px 7px;
  position: absolute;
  transform: translateX(-50%);
}

.wish-arrival-info {
  align-content: center;
  display: grid;
  gap: 5px;
  justify-items: start;
  min-width: 0;
}

.wish-arrival-title {
  color: var(--book-ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  text-decoration: none;
}

.wish-arrival-title:hover {
  color: var(--book-teal);
}

.wish-arrival-meta {
  color: var(--book-muted);
  font-size: 13px;
}

.wish-arrival-actions {
  border-top: 1px solid var(--book-line);
  display: flex;
  gap: 8px;
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding-top: 10px;
}

/* ---------------- Book clubs: the wandering club book ---------------- */

/* A book cover with a colored spine underneath, for books without a listing
   photo (the club book). */
.wander-cover {
  aspect-ratio: 2 / 3;
  background: var(--spine, var(--book-teal));
  border-radius: 3px 7px 7px 3px;
  box-shadow: inset 5px 0 0 rgba(0,0,0,0.14), 0 6px 14px rgba(0,0,0,0.16);
  display: block;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  width: 64px;
}

.wander-cover.is-small {
  width: 36px;
}

.wander-cover-spine {
  color: #fff;
  display: -webkit-box;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  padding: 7px 5px 7px 9px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
}

.wander-cover.is-small .wander-cover-spine {
  font-size: 0;
}

.wander-cover img {
  height: 100%;
  inset: 0;
  object-fit: cover;
  position: absolute;
  width: 100%;
}

/* The bar above the club chat */
.wander-bar {
  align-items: center;
  background: linear-gradient(90deg, rgba(30,105,104,0.08), rgba(30,105,104,0.02));
  border-bottom: 1px solid var(--book-line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 18px;
}

.wander-bar.is-empty {
  background: rgba(23,25,29,0.03);
}

.wander-bar-icon {
  color: var(--book-teal);
  font-size: 18px;
}

.wander-bar.is-empty .wander-bar-text {
  color: var(--book-muted);
  flex: 1 1 260px;
  font-size: 13px;
}

.wander-bar-book {
  align-items: center;
  background: none;
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  color: var(--book-ink);
  cursor: pointer;
  display: flex;
  flex: 1 1 240px;
  font: inherit;
  gap: 12px;
  margin: -4px;
  min-width: 0;
  padding: 4px;
  text-align: left;
}

.wander-bar-book:hover,
.wander-bar-book:focus {
  background: rgba(30,105,104,0.08);
  color: var(--book-ink);
}

.wander-bar-book .wander-bar-text {
  display: grid;
  line-height: 1.25;
  min-width: 0;
}

.wander-bar-text small {
  color: var(--book-teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wander-bar-text strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wander-bar-text > span {
  color: var(--book-muted);
  font-size: 12px;
}

.wander-bar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wander-bar-status {
  color: var(--book-teal);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

a.wander-bar-status:hover {
  text-decoration: underline;
}

.wander-release-form[hidden],
.wander-bar-error[hidden] {
  display: none;
}

.wander-release-form,
.wander-sent-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wander-release-form input,
.wander-sent-form input {
  border: 1px solid var(--book-line);
  border-radius: 10px;
  flex: 1 1 200px;
  font: inherit;
  font-size: 14px;
  min-width: 0;
  padding: 8px 12px;
}

.wander-sent-form .swap-card-actions {
  flex-basis: 100%;
}

.wander-bar-error {
  color: var(--book-error);
  flex-basis: 100%;
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

@media (max-width: 640px) {
  .wander-bar {
    padding: 10px 12px;
  }

  /* The whole bar opens the shelf; no extra button on small screens. */
  .wander-bar-actions .swap-btn-primary {
    display: none;
  }

  .wander-bar-actions:not(:has(.wander-bar-status)) {
    display: none;
  }

  .wander-bar-actions {
    flex-basis: 100%;
  }
}

/* The shelf panel */
.wander-add {
  background: var(--book-panel-strong);
  border: 1px dashed rgba(30,105,104,0.4);
  border-radius: 16px;
  padding: 12px 14px;
}

.wander-add summary {
  color: var(--book-teal);
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.wander-add summary::-webkit-details-marker {
  display: none;
}

.wander-add-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.wander-hint {
  color: var(--book-muted);
  font-size: 13px;
  margin: 0;
}

.wander-add-fields {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 2fr 1.4fr;
}

.wander-add-form input {
  border: 1px solid var(--book-line);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  min-width: 0;
  padding: 9px 12px;
}

.wander-add-actions {
  display: flex;
  justify-content: flex-end;
}

.wander-filter {
  margin: 0;
}

.wander-filter .wander-filter-input {
  min-height: 42px;
  text-align: left;
}

.wander-filter-empty {
  color: var(--book-muted);
  margin: 0;
}

.wander-books {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.wander-book {
  background: var(--book-panel-strong);
  border: 2px solid transparent;
  border-radius: 16px;
  display: grid;
  gap: 10px;
  padding: 12px 14px;
}

.wander-book[hidden] {
  display: none;
}

.wander-book.is-pinned {
  border-color: rgba(30,105,104,0.35);
}

.wander-book-main {
  align-items: flex-start;
  display: flex;
  gap: 14px;
}

.wander-book-main .wander-cover {
  width: 54px;
}

.wander-book-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.wander-book-pin {
  color: var(--book-teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wander-book-info strong {
  font-size: 15px;
  line-height: 1.3;
}

.wander-book-author,
.wander-book-stats {
  color: var(--book-muted);
  font-size: 13px;
}

.wander-book-stats b {
  color: var(--book-teal);
}

.wander-book-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 6px;
}

.wander-book-status {
  color: var(--book-teal);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

a.wander-book-status:hover {
  text-decoration: underline;
}

.wander-book-route summary {
  color: var(--book-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}

.wander-book-route summary::-webkit-details-marker {
  display: none;
}

.wander-book-route[open] summary {
  margin-bottom: 10px;
}

.wander-book-route .wander-copy {
  background: rgba(23,25,29,0.03);
  margin-bottom: 8px;
}

.wander-empty {
  color: var(--book-muted);
  font-size: 13px;
  margin: 0 0 8px;
}

.wander-owner-actions {
  border-top: 1px solid var(--book-line);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 8px;
  padding-top: 6px;
}

@media (max-width: 640px) {
  .wander-add-fields {
    grid-template-columns: 1fr;
  }
}

/* The giver's terms: price and who pays postage */
.wander-terms {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.wander-terms-price {
  align-items: center;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
  margin: 0;
}

.wander-add-form input,
.wander-release-form input,
.wander-sent-form input {
  margin: 0;
}

.wander-terms-price input {
  border: 1px solid var(--book-line);
  border-radius: 10px;
  font: inherit;
  padding: 7px 10px;
  text-align: right;
  width: 90px;
}

.wander-terms-postage {
  align-items: center;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0;
  padding: 0;
}

.wander-terms-postage legend {
  float: left;
  font-size: 13px;
  font-weight: 700;
  margin-right: 4px;
  padding: 0;
}

.wander-terms-postage label {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  white-space: nowrap;
  font-size: 13px;
  gap: 5px;
  margin: 0;
}

.wander-terms-postage input {
  accent-color: var(--book-teal);
  margin: 0;
}

.wander-release-form .wander-terms {
  flex-basis: 100%;
}

.wander-card-terms {
  background: rgba(23,25,29,0.04);
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 700;
  gap: 4px 14px;
  padding: 8px 10px;
}

.wander-card-terms i {
  color: var(--book-muted);
  margin-right: 3px;
}

.wander-card-terms.has-terms {
  background: rgba(215,111,53,0.1);
}

.wander-card-terms.has-terms i {
  color: var(--book-orange);
}

.wander-card-terms small {
  color: var(--book-muted);
  flex-basis: 100%;
  font-weight: 400;
}

/* The copies of a book, first come first served */
.wander-offers {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.wander-offer {
  align-items: center;
  background: rgba(23,25,29,0.03);
  border-radius: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  padding: 8px 10px;
}

.wander-offer > img {
  border-radius: 50%;
  height: 28px;
  object-fit: cover;
  width: 28px;
}

.wander-offer-text {
  display: grid;
  min-width: 0;
}

.wander-offer-text strong {
  font-size: 13px;
}

.wander-offer-text small {
  color: var(--book-muted);
  font-size: 12px;
}

.wander-offer.is-available {
  background: rgba(30,105,104,0.08);
}

.wander-offer.is-moving .wander-offer-text strong {
  color: var(--book-orange);
}

.wander-offer.is-reading {
  opacity: 0.75;
}

.wander-offer .is-watching {
  color: var(--book-teal);
  text-decoration: none;
}

@media (max-width: 480px) {
  .wander-offer {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .wander-offer-action {
    grid-column: 1 / -1;
  }

  .wander-offer-action .swap-btn {
    width: 100%;
  }
}

/* Notices from the official Second Shelf account */
.notice-card .swap-card-head {
  background: var(--book-ink);
  color: #fff;
}

.notice-card-body {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.notice-card-body p {
  font-size: 14px;
  margin: 0;
}

.notice-card-hint {
  color: var(--book-muted);
}

.notice-card-done {
  color: var(--book-teal);
  font-size: 13px;
  font-weight: 800;
}

/* Folding the bar in and out */
.wander-bar-book {
  flex: 1 1 auto;
  justify-content: flex-start;
}

.wander-bar-toggle {
  align-items: center;
  align-self: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--book-muted);
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  height: 32px;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
  width: 32px;
}

.wander-bar-toggle:hover {
  background: rgba(30,105,104,0.1);
  color: var(--book-teal);
}

.wander-bar-toggle i {
  transition: transform 0.2s ease;
}

.wander-bar.is-collapsed {
  padding-bottom: 4px;
  padding-top: 4px;
}

.wander-bar.is-collapsed .wander-bar-text > span,
.wander-bar.is-collapsed .wander-bar-actions {
  display: none;
}

.wander-bar.is-collapsed .wander-bar-text {
  align-items: baseline;
  display: flex;
  gap: 8px;
}

.wander-bar.is-collapsed .wander-bar-icon {
  font-size: 14px;
  position: relative;
}

.wander-bar.is-collapsed .wander-bar-text strong {
  color: var(--book-muted);
  font-size: 13px;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wander-bar.is-collapsed .wander-bar-toggle {
  height: 26px;
  width: 26px;
}

.wander-bar.is-collapsed .wander-bar-toggle i {
  transform: rotate(180deg);
}

/* Folded in, but a copy is on its way to or from you: a dot on the icon. */
.wander-bar.is-collapsed[data-alert] .wander-bar-icon::after {
  background: var(--book-orange);
  border: 2px solid #fff;
  border-radius: 50%;
  content: "";
  height: 9px;
  position: absolute;
  right: -5px;
  top: -3px;
  width: 9px;
}

@media (max-width: 640px) {
  /* The toggle stays on the first line, next to the title. */
  .wander-bar-book {
    flex: 1 1 0;
    min-width: 0;
  }

  .wander-bar-toggle {
    order: 2;
  }

  .wander-bar-actions {
    order: 3;
  }
}

/* Offer cards of a wander shelf deal */
.wander-counter-form {
  border-top: 1px solid var(--book-line);
  display: grid;
  gap: 10px;
  padding-top: 10px;
}

.wander-counter-form[hidden] {
  display: none;
}

.wander-counter-form input {
  margin: 0;
}

.wander-counter-form .swap-btn {
  justify-self: end;
}

.wander-offer-card.is-deal .swap-card-head {
  background: var(--book-teal);
  color: #fff;
}

/* Lines in the club chat */
.wander-line span {
  background: rgba(30,105,104,0.1);
  color: var(--book-teal);
}

.wander-line strong {
  color: var(--book-ink);
}

/* The route panel */
.wander-panel-box {
  max-width: 560px;
}

.wander-panel-body {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 22px 22px;
}

.wander-panel-body h3 {
  color: var(--book-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 8px 0 0;
  text-transform: uppercase;
}

.wander-route,
.wander-waiting {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wander-copy {
  background: var(--book-panel-strong);
  border-radius: 16px;
  padding: 12px 14px;
}

.wander-copy-label {
  color: var(--book-muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.wander-station {
  display: grid;
  gap: 10px;
  grid-template-columns: 30px minmax(0, 1fr);
  padding-bottom: 12px;
  position: relative;
}

.wander-station::before {
  border-left: 2px dashed var(--book-line);
  bottom: 0;
  content: "";
  left: 14px;
  position: absolute;
  top: 32px;
}

.wander-station:last-child {
  padding-bottom: 0;
}

.wander-station:last-child::before {
  display: none;
}

.wander-station img {
  border-radius: 50%;
  height: 30px;
  object-fit: cover;
  width: 30px;
}

.wander-station.is-now img {
  box-shadow: 0 0 0 3px var(--book-orange);
}

.wander-station > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.wander-station strong {
  font-size: 14px;
}

.wander-station small {
  color: var(--book-muted);
  font-size: 12px;
}

.wander-station.is-now small {
  color: var(--book-orange);
  font-weight: 700;
}

.wander-station q {
  background: rgba(30,105,104,0.07);
  border-radius: 4px 12px 12px 12px;
  color: var(--book-ink);
  font-size: 13px;
  font-style: italic;
  justify-self: start;
  margin-top: 4px;
  padding: 6px 10px;
}

.wander-waiting {
  counter-reset: wait;
  display: grid;
  gap: 6px;
}

.wander-waiting li {
  align-items: center;
  counter-increment: wait;
  display: flex;
  font-size: 14px;
  font-weight: 700;
  gap: 8px;
}

.wander-waiting li::before {
  color: var(--book-muted);
  content: counter(wait) ".";
  width: 18px;
}

.wander-waiting img {
  border-radius: 50%;
  height: 24px;
  object-fit: cover;
  width: 24px;
}

/* The handover card in the private chat */
.wander-card-body {
  align-items: center;
  display: flex;
  gap: 14px;
  padding: 14px 14px 0;
}

.wander-card-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.wander-card-club {
  color: var(--book-teal);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.wander-card-info strong {
  font-size: 15px;
}

.wander-card-route {
  color: var(--book-muted);
  font-size: 13px;
  font-weight: 700;
}

.wander-card-route i {
  color: var(--book-orange);
  margin: 0 4px;
}

.wander-status-done .swap-card-head {
  background: var(--book-teal);
  color: #fff;
}

/* Shared shelves in the member lists */
.bookclub-shared-shelf {
  color: var(--book-orange);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.bookclub-shared-shelf:hover {
  text-decoration: underline;
}

/* ---------------- Book clubs: "Who has …?" ---------------- */

/* Creator's on/off switch (same look as the settings page's toggles, whose
   stylesheet isn't loaded on club pages). */
.club-owner-switch {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 14px;
  font-weight: 700;
  gap: 10px;
}

.club-owner-switch .settings-toggle {
  flex-shrink: 0;
  position: relative;
}

.club-owner-switch .settings-toggle input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.club-owner-switch .settings-toggle-track {
  background: var(--book-line);
  border-radius: 999px;
  display: block;
  height: 26px;
  position: relative;
  transition: background 0.2s ease;
  width: 44px;
}

.club-owner-switch .settings-toggle-thumb {
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(23,25,29,0.25);
  height: 20px;
  left: 3px;
  position: absolute;
  top: 3px;
  transition: transform 0.2s ease;
  width: 20px;
}

.club-owner-switch input:checked ~ .settings-toggle-track {
  background: var(--book-teal);
}

.club-owner-switch input:checked ~ .settings-toggle-track .settings-toggle-thumb {
  transform: translateX(18px);
}

.club-search-box {
  max-width: 560px;
}

.club-search-body {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 22px 22px;
}

.club-search-body h3 {
  color: var(--book-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 4px 0 0;
  text-transform: uppercase;
}

.club-search-form {
  display: grid;
  gap: 10px;
}

.club-search-fields {
  display: flex;
  gap: 8px;
}

.club-search-fields input {
  border: 1px solid var(--book-line);
  border-radius: 10px;
  flex: 1;
  font: inherit;
  min-width: 0;
  padding: 10px 12px;
}

.club-search-wishes {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.club-search-wishes > span {
  color: var(--book-muted);
  font-size: 12px;
  font-weight: 700;
}

.club-search-wish {
  background: var(--book-panel-strong);
  border: 1px solid var(--book-line);
  border-radius: 999px;
  color: var(--book-ink);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  padding: 5px 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.club-search-wish:hover {
  border-color: var(--book-teal);
  color: var(--book-teal);
}

.club-search-result {
  background: rgba(30,105,104,0.1);
  border-radius: 12px;
  color: var(--book-teal);
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  padding: 10px 12px;
}

.club-search-result.is-empty {
  background: rgba(215,111,53,0.1);
  color: var(--book-orange);
}

.club-search-result[hidden] {
  display: none;
}

.club-search-list {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.club-search-item {
  align-items: center;
  background: var(--book-panel-strong);
  border-radius: 12px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 8px 12px;
}

.club-search-item > div {
  display: grid;
  min-width: 0;
}

.club-search-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.club-search-item small {
  color: var(--book-muted);
  font-size: 12px;
}

.club-search-item:not(.is-open) {
  opacity: 0.6;
}

@media (max-width: 640px) {
  .club-search-body {
    overflow: visible;
  }
}

/* The notice for asked members, above the club chat */
.club-search-notices {
  border-bottom: 1px solid var(--book-line);
  display: grid;
  gap: 6px;
  padding: 8px 18px;
}

.club-search-notice {
  align-items: center;
  background: rgba(215,111,53,0.08);
  border: 1px solid rgba(215,111,53,0.3);
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 12px;
}

.club-search-notice > i {
  color: var(--book-orange);
}

.club-search-notice-text {
  flex: 1 1 220px;
  font-size: 13px;
}

.club-search-notice-actions {
  align-items: center;
  display: flex;
  gap: 4px;
}

@media (max-width: 640px) {
  .club-search-notices {
    padding: 8px 12px;
  }
}

/* The reply card in the private chat */
.club-search-card .swap-card-head {
  background: rgba(215,111,53,0.12);
  color: var(--book-orange);
}

.club-search-card-body {
  align-items: center;
  display: flex;
  gap: 12px;
  padding: 14px 14px 4px;
}

.club-search-card-body img {
  border-radius: 3px 6px 6px 3px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  height: 64px;
  background-color: #f1ede7;
  object-fit: contain;
  width: 46px;
}

.club-search-card-body p {
  font-size: 14px;
  margin: 0;
}

.club-search-card-body small {
  color: var(--book-muted);
}

.club-search-card > :last-child {
  padding-bottom: 14px;
}

/* ---------------- Pickup & radius search ---------------- */

.place-picker {
  display: grid;
  gap: 8px;
}

.place-picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.place-picker-field {
  align-items: center;
  background: #fff;
  border: 1px solid var(--book-line);
  border-radius: 8px;
  display: flex;
  flex: 1 1 200px;
  gap: 8px;
  min-width: 0;
  padding: 0 10px;
}

.place-picker-field:focus-within {
  border-color: var(--book-teal);
}

.place-picker-field i {
  color: var(--book-teal);
}

.place-picker .place-picker-field .place-picker-input,
.place-picker .place-picker-field .place-picker-input:focus {
  background: transparent;
  border: 0;
  box-shadow: none;
  flex: 1;
  font: inherit;
  margin: 0;
  min-height: 42px;
  min-width: 0;
  outline: 0;
  padding: 0;
}

.place-picker-clear {
  background: none;
  border: 0;
  color: var(--book-muted);
  cursor: pointer;
  padding: 4px;
}

.place-picker-clear[hidden],
.place-picker-locate[hidden] {
  display: none;
}

.place-picker-results {
  background: #fff;
  border: 1px solid var(--book-line);
  border-radius: 10px;
  display: grid;
  list-style: none;
  margin: 0;
  overflow: hidden;
  padding: 0;
}

.place-picker-results[hidden] {
  display: none;
}

.place-picker-results button {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--book-line);
  color: var(--book-ink);
  cursor: pointer;
  display: grid;
  font: inherit;
  gap: 1px;
  justify-content: start;
  justify-items: start;
  padding: 8px 12px;
  text-align: left;
  width: 100%;
}

.place-picker-results li:last-child button {
  border-bottom: 0;
}

.place-picker-results button:hover,
.place-picker-results button:focus-visible {
  background: rgba(30,105,104,0.08);
}

.place-picker-results strong {
  font-size: 14px;
}

.place-picker-results small {
  color: var(--book-muted);
  font-size: 12px;
}

.place-picker-status {
  color: var(--book-muted);
  font-size: 13px;
  margin: 0;
}

.place-picker-status.is-error {
  color: var(--book-error);
}

.place-picker-status[hidden] {
  display: none;
}

.pickup-toggle {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: 700;
  gap: 8px;
  margin: 0 0 10px;
}

.pickup-toggle input {
  accent-color: var(--book-teal);
  height: 18px;
  margin: 0;
  width: 18px;
}

.pickup-place[hidden] {
  display: none;
}

.search-filter-radius {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.search-filter-radius .place-picker-row .swap-btn span {
  display: none;
}

.pickup-chip {
  background: #fff;
  color: var(--book-teal);
}

.listing-trade-chips .pickup-chip {
  background: #fff;
  color: var(--book-teal);
}

/* Listing page: a quiet line right under the shipping one (same look). */
.item-detail-shipping + .item-detail-pickup {
  margin-top: -14px;
}

.item-detail-pickup {
  margin: 0 0 20px;
}

.item-detail-pickup-text {
  align-items: center;
  color: var(--book-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  gap: 4px 8px;
}

.item-detail-pickup-text i {
  color: var(--book-teal);
}

.item-detail-pickup-text strong {
  color: var(--book-ink);
  font-weight: 700;
}

.item-detail-pickup-toggle {
  align-items: center;
  background: none;
  border: 0;
  color: var(--book-teal);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  gap: 4px;
  padding: 0;
}

.item-detail-pickup-toggle:hover span {
  text-decoration: underline;
}

.item-detail-pickup-toggle i {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.item-detail-pickup-toggle.is-open i {
  transform: rotate(180deg);
}

.item-detail-pickup-panel {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  max-width: 340px;
}

.item-detail-pickup-panel[hidden] {
  display: none;
}

.pickup-map {
  background: rgba(23,25,29,0.05);
  border-radius: 12px;
  overflow: hidden;
  z-index: 0;
}

.item-detail-pickup-map {
  border: 1px solid var(--book-line);
  height: 130px;
}

.pickup-map-note {
  color: var(--book-muted);
  font-size: 12px;
}

.search-map-wrap {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}

.search-map-toggle {
  justify-self: start;
}

.search-map {
  height: 380px;
}

.search-map[hidden] {
  display: none;
}

.map-popup {
  display: grid;
  gap: 2px;
}

.map-popup a {
  color: var(--book-teal);
  font-weight: 800;
}

.map-popup span {
  color: var(--book-muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  .search-map {
    height: 300px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .swap-picker,
  .swap-picker-box,
  .wish-book,
  .chat-swap-btn {
    transition: none;
  }

  .wish-book.is-new {
    animation: none;
  }
}

/* ---------------- Swap badges ---------------- */

.swap-badge {
  align-items: center;
  background: var(--book-panel-strong);
  border: 1px solid var(--book-line);
  border-radius: 16px;
  display: inline-flex;
  gap: 12px;
  margin: 4px 0 12px;
  max-width: 100%;
  padding: 10px 16px 10px 10px;
  text-align: left;
}

.swap-badge-medal {
  align-items: center;
  background: var(--book-teal);
  border-radius: 50%;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.15);
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-size: 18px;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.swap-badge.rank-2 .swap-badge-medal { background: var(--book-orange); }
.swap-badge.rank-3 .swap-badge-medal { background: var(--book-blue); }
.swap-badge.rank-4 .swap-badge-medal { background: linear-gradient(135deg, #d9b98a, #b8862f); }

.swap-badge.is-empty .swap-badge-medal {
  background: var(--book-line);
  color: var(--book-muted);
}

.swap-badge-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.swap-badge-text strong {
  font-size: 15px;
  font-weight: 900;
}

.swap-badge-text small {
  color: var(--book-muted);
  font-size: 12px;
}

.swap-badge-progress {
  background: var(--book-line);
  border-radius: 999px;
  display: block;
  height: 6px;
  margin: 4px 0 2px;
  overflow: hidden;
  width: 180px;
  max-width: 100%;
}

.swap-badge-progress i {
  background: var(--book-teal);
  border-radius: 999px;
  display: block;
  height: 100%;
}

.public-profile-swaps .swap-badge {
  margin: 0;
}

/* Home wish shelf cards: where their book can be picked up. */
.perfect-swap-pickup {
  grid-column: 1 / -1;
  justify-self: center;
}

.wish-arrival-info .pickup-chip,
.perfect-swap-pickup .pickup-chip {
  line-height: 1.3;
  max-width: 100%;
  white-space: normal;
}

/* The listing's small area map: smaller zoom buttons to match its size. */
.item-detail-pickup-map .leaflet-control-zoom {
  border-width: 1px;
  margin: 6px 0 0 6px;
}

.item-detail-pickup-map .leaflet-control-zoom a {
  font-size: 15px;
  height: 24px;
  line-height: 22px;
  width: 24px;
}

/* ------------------------------------------------------------------ */
/* Following authors and searches (follow-helpers.php)                 */
/* ------------------------------------------------------------------ */

/* The bell button: outlined until following, then filled teal. */
.follow-btn {
  align-items: center;
  background: transparent;
  border: 1px solid var(--book-line);
  border-radius: 999px;
  color: var(--book-ink);
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  line-height: 1;
  padding: 6px 11px;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  vertical-align: middle;
  white-space: nowrap;
}

.follow-btn i {
  color: var(--book-orange);
  transform-origin: 50% 0;
}

.follow-btn:hover {
  border-color: var(--book-orange);
}

.follow-btn.is-following {
  background: rgba(30,105,104,0.1);
  border-color: rgba(30,105,104,0.3);
  color: var(--book-teal);
}

.follow-btn.is-following i {
  color: var(--book-teal);
}

.follow-btn.is-ringing i {
  animation: follow-ring 0.7s ease;
}

@keyframes follow-ring {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(18deg); }
  30% { transform: rotate(-16deg); }
  45% { transform: rotate(12deg); }
  60% { transform: rotate(-8deg); }
  75% { transform: rotate(4deg); }
}

/* Search results: next to the title. */
.follow-btn-search {
  font-size: 13px;
  padding: 8px 14px;
}

/* A book's page: "by Patrick Rothfuss [🔔 Follow]" under the title. */
.item-detail-author {
  align-items: center;
  color: var(--book-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 15px;
  gap: 6px 12px;
  margin: -6px 0 16px;
}

.item-detail-author-name {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.item-detail-author-name a {
  color: var(--book-ink);
  font-weight: 800;
  text-decoration: none;
}

.item-detail-author-name a:hover {
  color: var(--book-teal);
  text-decoration: underline;
}

.control-group-author .field-hint i {
  color: var(--book-orange);
  margin-right: 3px;
}

/* Profile: "Following" — authors as round initials, searches as chips. */
.following-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.following-card {
  align-items: center;
  background: var(--book-panel-strong);
  border: 1px solid var(--book-line);
  border-radius: 16px;
  box-shadow: var(--book-shadow);
  display: flex;
  gap: 6px;
  padding: 10px 8px 10px 12px;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.following-card:hover {
  box-shadow: 0 14px 28px rgba(42,38,34,0.12);
  transform: translateY(-2px);
}

.following-card.is-leaving {
  opacity: 0;
  transform: scale(0.96);
}

.following-main {
  align-items: center;
  color: inherit;
  display: flex;
  flex: 1;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.following-avatar {
  align-items: center;
  background:
    linear-gradient(150deg, rgba(255,255,255,0.22), rgba(0,0,0,0.18)),
    var(--spine, var(--book-teal));
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25), 0 6px 14px rgba(0,0,0,0.14);
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  height: 46px;
  justify-content: center;
  letter-spacing: 0.02em;
  width: 46px;
}

.following-avatar.is-search {
  background: rgba(215,111,53,0.12);
  box-shadow: inset 0 0 0 1px rgba(215,111,53,0.3);
  color: var(--book-orange);
  font-size: 16px;
}

.following-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.following-kind {
  color: var(--book-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.following-info strong {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.following-info small {
  color: var(--book-muted);
  font-size: 12px;
}

.following-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.following-chips span {
  background: rgba(23,25,29,0.06);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
}

.following-remove {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--book-muted);
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  height: 34px;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
  width: 34px;
}

.following-remove:hover {
  background: rgba(181,73,91,0.1);
  color: var(--book-danger);
}

.following-empty {
  color: var(--book-muted);
  margin: 0;
}

.following-empty i {
  color: var(--book-orange);
  margin-right: 4px;
}

/* The chat notice: the new book as a little card. */
.follow-notice-book {
  align-items: center;
  background: rgba(23,25,29,0.04);
  border-radius: 12px;
  color: inherit;
  display: flex;
  gap: 12px;
  margin: 4px 0;
  padding: 8px;
  text-decoration: none;
}

.follow-notice-book:hover {
  background: rgba(30,105,104,0.08);
}

.follow-notice-book img {
  border-radius: 3px 6px 6px 3px;
  box-shadow: 0 5px 12px rgba(0,0,0,0.16);
  height: 64px;
  background-color: #f1ede7;
  object-fit: contain;
  width: 44px;
}

.follow-notice-book span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.follow-notice-book small {
  color: var(--book-muted);
  font-size: 12px;
}

.follow-notice-book em {
  color: var(--book-teal);
  font-style: normal;
  font-weight: 900;
}

/* Phones: the search bell shrinks to its icon next to the title. */
@media (max-width: 640px) {
  .follow-btn-search {
    justify-content: center;
    padding: 0;
    height: 38px;
    width: 38px;
  }

  .follow-btn-search span {
    display: none;
  }
}

/* Phones: title, bell and filter share one line — the title gives way. */
@media (max-width: 640px) {
  .search-title-row {
    gap: 8px;
  }

  .list-header .search-title-row h1 {
    flex: 1;
    font-size: 23px;
    hyphens: auto;
    min-width: 0;
  }
}

/* Public profile: favourite authors, each with a bell for the visitor. */
.public-author-list .following-card {
  padding-right: 12px;
}

.public-author-list .following-info strong {
  line-height: 1.2;
  white-space: normal;
}

/* A small difference (no top-up suggested yet) is named, just not in orange. */
.swap-scale.is-off .swap-scale-row:first-child span {
  color: var(--book-ink);
  font-weight: 800;
}

/* The picker's close button: quiet, like the sheet's other controls. */
.swap-picker-close {
  background: rgba(23,25,29,0.06);
  color: var(--book-muted);
  font-size: 15px;
  height: 38px;
  transition: background 0.15s ease, color 0.15s ease;
  width: 38px;
}

.swap-picker-close:hover {
  background: rgba(23,25,29,0.12);
  color: var(--book-ink);
}

/* The whole sheet scrolls, its parts keep their natural height — the book
   lists never get squeezed into a sliver when there's little room (the
   chat inside a book page). Title and buttons stay in view. */
.swap-picker-box {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.swap-picker-box > * {
  flex-shrink: 0;
}

.swap-picker-cols {
  overflow: visible;
}

.swap-picker-head {
  background: var(--book-bg);
  position: sticky;
  top: 0;
  z-index: 2;
}

.swap-picker-foot {
  background: var(--book-bg);
  bottom: 0;
  box-shadow: 0 -10px 20px -14px rgba(23,25,29,0.3);
  position: sticky;
  z-index: 2;
}

.swap-picker-close:focus:not(:focus-visible) {
  outline: none;
}

.swap-picker-close:focus-visible {
  outline: 2px solid var(--book-teal);
  outline-offset: 2px;
}

/* The book columns sit on their own layer (z-index 2) — the sticky title
   and buttons must stay above them, or the lists scroll through them. */
.swap-picker-head,
.swap-picker-foot {
  z-index: 5;
}

/* ---------------- Picker: one's own books, three at a time ---------------- */

.swap-picker-col-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin: 0 0 8px;
  min-height: 30px;
}

.swap-picker-col-head h3 {
  margin: 0;
}

.swap-pick-nav {
  align-items: center;
  display: flex;
  gap: 6px;
}

.swap-pick-nav button {
  align-items: center;
  background: rgba(23,25,29,0.06);
  border: 0;
  border-radius: 50%;
  color: var(--book-ink);
  cursor: pointer;
  display: flex;
  font-size: 11px;
  height: 30px;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  width: 30px;
}

.swap-pick-nav button:hover:not(:disabled) {
  background: var(--book-teal);
  color: #fff;
}

.swap-pick-nav button:disabled {
  cursor: default;
  opacity: 0.35;
}

.swap-pick-page {
  color: var(--book-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  min-width: 42px;
  text-align: center;
}

/* Pages of three side by side, each packed to the top; swiping (or the
   arrows) slides one page. */
.swap-pick-pages {
  align-items: flex-start;
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.swap-pick-pages::-webkit-scrollbar {
  display: none;
}

/* The hidden checkbox stays inside its own card — positioned against the
   sheet, a book on a later page would slide the whole sheet sideways when
   picked (focus scrolls it into view). */
.swap-pick {
  position: relative;
}

.swap-picker-box {
  overflow-x: hidden;
}

.swap-pick-pages > .swap-pick-list {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
}

@media (prefers-reduced-motion: no-preference) {
  .swap-pick-pages {
    scroll-behavior: smooth;
  }
}

/* The picker inside the chat window over a book page (an iframe): a dimmed
   backdrop of its own would stop at the window's edge and show as a dark
   frame. The chat behind it dims instead, and the book page's overlay
   darkens by the same amount (see chat.css). */
body.chat-page-embed .swap-picker {
  background: transparent;
}

body.chat-page-embed .chat-page {
  transition: filter 0.2s ease;
}

html.swap-picker-open body.chat-page-embed .chat-page {
  filter: brightness(0.55);
}

/* ---------------- Club chat: a copy wandered on ---------------- */

/* A small ticket instead of the plain system pill: the book, and the route
   it just took. (Resets the pill look .bookclub-chat-system gives spans.) */
.bookclub-chat-system.wander-move-line span {
  background: none;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  padding: 0;
  text-align: left;
}

.bookclub-chat-system.wander-move-line .wander-move {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(30,105,104,0.16);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(23,25,29,0.07);
  display: flex;
  gap: 12px;
  max-width: min(360px, 100%);
  padding: 9px 14px 9px 10px;
}

.bookclub-chat-system.wander-move-line .wander-move-cover {
  /* (A span too — gets its book color back from the reset above.) */
  background: var(--spine, var(--book-teal));
  border-radius: 2px 5px 5px 2px;
  box-shadow: inset 3px 0 0 rgba(0,0,0,0.14), 0 3px 8px rgba(0,0,0,0.16);
  width: 34px;
}

.bookclub-chat-system.wander-move-line .wander-cover-spine {
  font-size: 0;
}

.bookclub-chat-system.wander-move-line .wander-move-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.bookclub-chat-system.wander-move-line .wander-move-kicker {
  color: var(--book-teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bookclub-chat-system.wander-move-line .wander-move-kicker i {
  margin-right: 3px;
}

.bookclub-chat-system.wander-move-line .wander-move-title {
  color: var(--book-ink);
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookclub-chat-system.wander-move-line .wander-move-route {
  align-items: center;
  color: var(--book-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 6px;
}

.bookclub-chat-system.wander-move-line .wander-move-route i {
  color: var(--book-orange);
  margin: 0;
}

.bookclub-chat-system.wander-move-line .wander-move-route strong {
  color: var(--book-ink);
  font-weight: 800;
}

/* ---------------- Wander shelf: the club's genres ---------------- */

.wander-genres {
  background: var(--book-panel-strong);
  border-radius: 14px;
  padding: 12px 14px;
}

.wander-genres.is-unset {
  background: color-mix(in srgb, var(--book-teal) 7%, #fff);
  border: 1.5px dashed color-mix(in srgb, var(--book-teal) 35%, transparent);
}

.wander-genres-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wander-genres-row[hidden],
.wander-genres-callout[hidden],
.wander-genres-form[hidden] {
  display: none;
}

.wander-genres-label {
  color: var(--book-muted);
  font-size: 12px;
  font-weight: 800;
}

.wander-genres-label i {
  color: var(--book-teal);
  margin-right: 3px;
}

.wander-genres-row .swap-btn-link {
  margin-left: auto;
}

.wander-genres-callout {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.wander-genres-callout strong i {
  color: var(--book-teal);
  margin-right: 4px;
}

.wander-genres-callout p {
  color: var(--book-muted);
  font-size: 13px;
  margin: 0;
}

.wander-genres-form {
  display: grid;
  gap: 12px;
}

.wander-genres-form .wander-add-actions {
  justify-content: flex-end;
}

.wander-genre-choice {
  display: grid;
  gap: 6px;
}

.wander-genre-choice-label {
  color: var(--book-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wander-book-genre {
  align-items: center;
  align-self: flex-start;
  background: color-mix(in srgb, var(--spine, var(--book-teal)) 12%, transparent);
  border-radius: 999px;
  color: var(--spine, var(--book-teal));
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  gap: 5px;
  padding: 2px 9px 2px 7px;
  width: fit-content;
}

.wander-book-genre::before {
  background: var(--spine, var(--book-teal));
  border-radius: 2px;
  content: '';
  height: 9px;
  width: 4px;
}

/* "They add" while I'd already get more: locked, with the reason below. */
.swap-topup-choice label:has(input:disabled) {
  cursor: not-allowed;
}

.swap-topup-choice input:disabled + span {
  color: rgba(23,25,29,0.28);
  text-decoration: line-through;
  text-decoration-color: rgba(23,25,29,0.2);
}

.swap-topup small.swap-topup-locked {
  align-items: center;
  color: var(--book-orange);
  display: flex;
  font-weight: 700;
  gap: 6px;
}

.swap-topup small.swap-topup-locked[hidden] {
  display: none;
}

/* What following means: a bubble at the bell (js/follow.js) — on hover
   with a mouse, on a tap (with the follow button inside) on touch. */
.follow-wrap {
  display: inline-flex;
  flex-shrink: 0;
  vertical-align: middle;
}

.follow-bubble {
  background: var(--book-ink);
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(23,25,29,0.28);
  color: #fff;
  display: grid;
  gap: 10px;
  left: 0;
  max-width: min(290px, calc(100vw - 24px));
  opacity: 0;
  padding: 12px 14px;
  pointer-events: none;
  position: fixed;
  top: 0;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 10100;
}

.follow-bubble.is-above {
  transform: translateY(4px);
}

.follow-bubble.is-open {
  opacity: 1;
  transform: none;
}

.follow-bubble.has-action {
  pointer-events: auto;
}

.follow-bubble[hidden] {
  display: none;
}

/* The little arrow pointing at the bell. */
.follow-bubble::before {
  background: var(--book-ink);
  border-radius: 2px;
  content: '';
  height: 10px;
  left: calc(var(--arrow-x, 50%) - 5px);
  position: absolute;
  top: -4px;
  transform: rotate(45deg);
  width: 10px;
}

.follow-bubble.is-above::before {
  bottom: -4px;
  top: auto;
}

.follow-bubble-body {
  display: grid;
  gap: 4px;
  line-height: 1.4;
}

.follow-bubble-body strong {
  font-size: 14px;
  font-weight: 900;
}

.follow-bubble-body span {
  color: rgba(255,255,255,0.86);
  font-size: 13px;
}

.follow-bubble-body small {
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  font-weight: 700;
}

.follow-bubble-action {
  align-items: center;
  background: var(--book-orange);
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  display: none;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  gap: 7px;
  justify-content: center;
  padding: 9px 14px;
}

.follow-bubble.has-action .follow-bubble-action {
  display: inline-flex;
}

.follow-bubble-action.is-following {
  background: rgba(255,255,255,0.14);
}

@media (prefers-reduced-motion: reduce) {
  .follow-bubble {
    transition: none;
  }
}


/* Buy / pay — everywhere it leads to the checkout (checkout-helpers.php):
   the warm orange of the price tags, so it reads as "this costs money". */
.swap-btn.swap-btn-buy,
.swap-btn.buy-btn {
  align-items: center;
  background: var(--book-orange);
  border-color: var(--book-orange);
  color: #fff;
  display: inline-flex;
  gap: 7px;
  text-decoration: none;
}

.swap-btn.swap-btn-buy:hover,
.swap-btn.buy-btn:hover {
  background: #c35f28;
  border-color: #c35f28;
  color: #fff;
}
