/* One quiet tool strip on the selected book, independent of cover imagery. */
.book-actions {
  --book-action-size: 34px;
  --book-action-danger: #c7a39a;
  --book-action-danger-hover: #ffd0c2;
  --book-action-danger-wash: #b565532c;
  position: absolute; top: 18px; right: -12px; z-index: 4;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line)); border-radius: 26px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--surface-raised) 97%, transparent), color-mix(in srgb, var(--surface) 96%, transparent));
  box-shadow: 0 8px 22px #0003, inset 0 1px color-mix(in srgb, var(--text) 6%, transparent);
  backdrop-filter: blur(16px);
}
.book-action-button {
  position: relative; display: grid; place-items: center; flex: 0 0 auto;
  width: var(--book-action-size); height: var(--book-action-size); padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer;
  transition: color .15s, background .15s;
}
.book-action-button .icon { width: 17px; height: 17px; stroke-width: 1.55; }
.book-action-button:hover, .book-action-button:focus-visible { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-strong); }
.book-action-button:focus-visible { outline-offset: 2px; }
.book-action-button.is-danger { color: var(--book-action-danger); }
.book-action-button.is-danger:hover, .book-action-button.is-danger:focus-visible { color: var(--book-action-danger-hover); background: var(--book-action-danger-wash); }
.book-action-divider { height: 1px; margin: 3px 8px; background: var(--line); }
.book-action-label {
  position: absolute; right: calc(100% + 15px); top: 50%; transform: translate(4px, -50%);
  white-space: nowrap; padding: 7px 11px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--text); box-shadow: 0 5px 16px #0002;
  font-size: 11px; font-weight: 400; line-height: 1.35;
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
}
.book-action-button:hover .book-action-label, .book-action-button:focus-visible .book-action-label { opacity: 1; transform: translate(0, -50%); }
:root[data-theme="paper"] .book-actions { --book-action-danger: #985141; --book-action-danger-hover: #893d32; --book-action-danger-wash: #a7564115; box-shadow: 0 6px 20px #38465220, inset 0 1px #fff9; }
.grid-mode .book-action-button .icon { width: 15px; height: 15px; }
.book-action-dialog { width: min(570px, calc(100vw - 32px)); }
.book-action-identity { display: flex; align-items: center; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.book-action-emblem { display: grid; place-items: center; width: 48px; height: 64px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 2px 7px 7px 2px; color: var(--accent); background: var(--accent-wash); }
.book-action-emblem .icon { width: 25px; height: 25px; }
.book-action-identity .eyebrow { font-size: 9px; }.book-action-identity h3 { font: 24px/1.5 var(--serif); margin: 4px 0; }.book-action-identity p { color: var(--muted); font-size: 11px; margin: 0; }
.book-details-list { margin: 0; }.book-details-list > div { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; line-height: 1.9; }.book-details-list dt { color: var(--faint); }.book-details-list dd { margin: 0; overflow-wrap: anywhere; }
.book-export-formats { padding: 0; margin: 0; border: 0; min-width: 0; }.book-export-formats legend { font-size: 12px; margin-bottom: 12px; }.book-export-formats label { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; cursor: pointer; background: var(--surface-soft); }.book-export-formats label:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }.book-export-formats input { width: 15px; height: 15px; padding: 0; margin: 0; accent-color: var(--accent); flex-shrink: 0; }.book-export-formats strong, .book-export-formats small { display: block; }.book-export-formats strong { font-size: 13px; font-weight: 500; }.book-export-formats small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.book-delete-notice { display: flex; align-items: flex-start; gap: 14px; border: 1px solid #c27e6240; border-radius: 9px; background: #a7564110; padding: 19px; }.book-delete-notice > .icon { flex-shrink: 0; color: #c58470; }.book-delete-notice h3 { font-size: 14px; margin: 0 0 8px; }.book-delete-notice p { color: var(--muted); font-size: 12px; line-height: 1.9; margin: 0; }
.book-action-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }.book-action-footer .danger-preview { color: #c58470; border-color: #c27e6255; background: #a7564110; }
@media (max-width: 1300px) { .book-actions { --book-action-size: 30px; top: 12px; right: -10px; padding: 5px; }.book-action-button .icon { width: 16px; height: 16px; } }
@media (max-width: 600px) { .grid-mode .book-cover, .grid-mode .book-display.is-selected .book-cover { width: 112px; }.book-action-dialog { width: calc(100vw - 24px); }.book-details-list > div { grid-template-columns: 62px minmax(0, 1fr); gap: 12px; } }
@media (prefers-reduced-motion: reduce) { .book-action-button, .book-action-label { transition: none; } }

/* Larger targets; destructive action stays visually separated. */
.book-actions, .grid-mode .book-actions { --book-action-size: 44px; }
.book-action-divider, .grid-mode .book-action-divider { margin: 8px 5px; }
.book-action-label { font-size: 12px; }
@media (max-width:700px), (pointer:coarse) {
  .books.shelf-carousel { height:calc(var(--shelf-cover-width) / .71 + var(--shelf-top-space) + 170px); }
  .book-front { flex-direction: column; align-items: center; }
  .book-actions, .grid-mode .book-actions { position: static; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); width:190px; max-width:100%; margin-top:8px; padding:5px; gap:4px; border-radius:10px; }
  .book-action-button { display:flex; align-items:center; justify-content:center; gap:4px; width:100%; min-height:44px; border-radius:6px; }
  .book-action-label { position:static; transform:none; opacity:1; padding:0; border:0; box-shadow:none; background:none; font-size:10px; color:inherit; }
  .book-action-button:hover .book-action-label, .book-action-button:focus-visible .book-action-label { transform:none; }
  .book-action-divider { display:none; }
  .book-action-button.is-danger { border-left:1px solid var(--line); }
}

#book-title-input { width: 100%; min-width: 0; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; }
#book-title-input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Grid cards reserve a separate footer for actions, away from the book faces. */
.grid-mode .books { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.grid-mode .book-display, .grid-mode .book-display.is-selected {
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr 54px; gap: 12px; justify-items: center; align-items: start;
}
.grid-mode .book-front { display: contents; }
.grid-mode .book-select { grid-column: 1; grid-row: 1; }
.grid-mode .book-caption { grid-column: 1; grid-row: 2; text-align: center; overflow-wrap: anywhere; }
.grid-mode .book-actions {
  position: static; grid-column: 1; grid-row: 3; align-self: end;
  display: flex; flex-direction: row; justify-content: center;
  width: auto; max-width: 100%; margin: 0; padding: 4px; gap: 0;
  border-radius: 10px; box-shadow: none; backdrop-filter: none;
  background: var(--surface-soft);
}
.grid-mode .book-action-button { display: grid; width: 44px; height: 44px; min-height: 44px; border-radius: 6px; }
.grid-mode .book-action-button.is-danger { border-left: 1px solid var(--line); }
.grid-mode .book-action-divider { display: none; }
.grid-mode .book-action-label {
  position: absolute; top: calc(100% + 8px); right: auto; left: 50%;
  transform: translate(-50%, -4px); opacity: 0;
  padding: 7px 11px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--text); box-shadow: 0 5px 16px #0002; font-size: 12px;
}
.grid-mode .book-action-button:hover .book-action-label,
.grid-mode .book-action-button:focus-visible .book-action-label { opacity: 1; transform: translate(-50%, 0); }
