:root {
  --bg: #faf8f5; --fg: #1f1d1a; --muted: #6b665e; --line: #e4dfd7;
  --card: #ffffff; --accent: #2f5d50; --accent-fg: #ffffff; --ready: #2f7a3f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614; --fg: #ece8e1; --muted: #a39d93; --line: #2e2b27;
    --card: #1f1d1a; --accent: #7fb8a4; --accent-fg: #10201b; --ready: #8fd19e;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.45 system-ui, sans-serif; }
main { max-width: 1120px; margin: 0 auto; padding: 32px 16px 64px; }
h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.search input {
  width: 100%; font: inherit; font-size: 1.05rem; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-box { position: relative; }
.search-box input { padding-right: 48px; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; padding: 0; border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted);
}
.clear[hidden] { display: none; }
.clear:hover:not(:disabled), .clear:focus-visible, .clear:active { background: var(--line); color: var(--fg); }
.clear svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.msg { color: var(--muted); min-height: 1.4em; margin: 10px 0; }
.msg:empty { margin: 0; }
.books { list-style: none; margin: 0; padding: 0; }
.books li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); }
.cover { width: 56px; height: 84px; object-fit: cover; border-radius: 3px; flex: none; background: var(--line); }
.info { flex: 1; min-width: 0; }
/* Long titles clamp (full title on hover) so the card stays compact. */
.title {
  font-weight: 600; line-height: 1.3; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.subtitle {
  color: var(--muted); font-size: 0.88rem; line-height: 1.3; margin-top: 2px; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.subtitle + .meta { margin-top: 2px; }
.title:has(+ .subtitle) { -webkit-line-clamp: 2; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.formats { display: flex; gap: 4px; }
.meta { color: var(--muted); font-size: 0.88rem; }
.badge { font-size: 0.72rem; padding: 1px 7px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; }
.status-ready { color: var(--ready); font-weight: 600; }
button {
  font: inherit; font-size: 0.9rem; padding: 7px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--accent); background: transparent; color: var(--accent); flex: none;
}
button:hover:not(:disabled), button:focus-visible, button:active { background: var(--accent); color: var(--accent-fg); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.6; cursor: default; }
.done { color: var(--muted); font-size: 0.9rem; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Phones: one column, your requests under the search. Wide screens: results
   on the left, your requests in a sidebar on the right. */
.layout { display: grid; gap: 40px 48px; }
.mine { display: flex; flex-direction: column; gap: 40px; }
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
}

/* Request button: plus icon and label, centered on one line. */
button.request { display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px 10px 10px; }
/* Trim the label to cap height and baseline so flex centers the letters, not the line box. */
button.request span { text-box: trim-both cap alphabetic; }
button.request svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ---- whimsy: the dog and a faint warm glow. */
:root { --glow: rgba(217, 160, 102, 0.10); }
@media (prefers-color-scheme: dark) {
  :root { --glow: rgba(217, 160, 102, 0.06); }
}
body {
  min-height: 100vh;
  background: radial-gradient(ellipse 60% 40% at 15% 0%, var(--glow), transparent 70%), var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.brand h1 { margin: 0; }
.dog { width: 32px; height: 32px; image-rendering: pixelated; flex: none; transform-origin: 50% 90%; }
@media (prefers-reduced-motion: no-preference) {
  .dog { transition: transform 0.2s; }
  .dog:hover { transform: rotate(-8deg); }
}
