/* ============ Bookshelf ============ */
:root {
  --ink: #2b2118;
  --paper: #f6efe3;
  --paper-2: #ece2d0;
  --muted: #7a6a58;
  --accent: #b5512b;
  --accent-ink: #fff8ef;
  --wood-dark: #2a1a10;
  --wood: #6b4121;
  --wood-light: #b07a45;
  --row: 220px;          /* height of one shelf, including plank */
  --plank: 24px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
  --scale: 1;            /* spine width multiplier (smaller on phones) */
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: #1c120b radial-gradient(ellipse at top, #3a2516 0%, #1c120b 70%) fixed;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.small { font-size: .85rem; }
.muted { color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4em;
  border: 1px solid rgba(0,0,0,.15);
  background: var(--paper);
  padding: .5em .9em; border-radius: 8px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  font-size: .92rem; line-height: 1.2;
  transition: background .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { background: #9e4322; }
.btn.danger { background: transparent; color: #a3271d; border-color: #e3b9b4; }
.btn.danger:hover { background: #fbecea; }
.btn.ghost { background: transparent; }
.topbar .btn.ghost { color: var(--paper); border-color: rgba(246,239,227,.25); }
.topbar .btn.ghost:hover { background: rgba(246,239,227,.1); }
.topbar .btn.subtle { opacity: .7; }
.icon-btn { border: 0; background: transparent; font-size: 1.1rem; cursor: pointer; padding: .3em .5em; border-radius: 6px; color: var(--muted); }
.icon-btn:hover { background: var(--paper-2); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between;
  padding: .9rem clamp(1rem, 3vw, 2.5rem);
  padding-top: max(.9rem, env(safe-area-inset-top));
  background: rgba(28,18,11,.88);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: var(--paper);
}
.brand { display: flex; align-items: baseline; gap: .8rem; }
.brand h1 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 1.6rem; letter-spacing: .01em; }
.count { color: #c9b79e; font-size: .9rem; font-variant-numeric: tabular-nums; }
.tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.tools input[type=search], .tools select {
  background: rgba(246,239,227,.08); color: var(--paper);
  border: 1px solid rgba(246,239,227,.2); border-radius: 8px;
  padding: .5em .75em; font-size: .92rem;
}
.tools input[type=search] { width: min(260px, 60vw); }
.tools input::placeholder { color: #a8957c; }
.tools select option { color: var(--ink); }

.banner { background: #f3d58a; color: #3d2c06; padding: .7rem clamp(1rem, 3vw, 2.5rem); font-size: .92rem; }

main { padding: clamp(1rem, 3vw, 2.5rem); padding-bottom: 7rem; }

/* ---------- the bookcase ---------- */
.bookcase {
  max-width: 1400px; margin: 0 auto;
  border-radius: 6px;
  padding: 18px 18px 0;
  /* outer frame */
  background:
    linear-gradient(90deg, rgba(0,0,0,.25), transparent 6%, transparent 94%, rgba(0,0,0,.25)),
    repeating-linear-gradient(90deg, #7a4a26 0 3px, #714422 3px 7px, #7d4d28 7px 12px),
    #74462a;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.7), inset 0 2px 0 rgba(255,255,255,.12);
}
.shelf {
  position: relative;
  display: flex; flex-wrap: wrap; align-content: flex-start;
  padding: 0 14px;
  min-height: calc(var(--row) * 3);
  background:
    /* plank front edge */
    repeating-linear-gradient(180deg,
      transparent 0, transparent calc(var(--row) - var(--plank)),
      #c38c55 calc(var(--row) - var(--plank)), #b07a45 calc(var(--row) - var(--plank) + 3px),
      #94602f calc(var(--row) - 7px), #5e3a1c calc(var(--row) - 7px), #4a2d15 var(--row)),
    /* shadow cast by the plank above onto the back panel */
    repeating-linear-gradient(180deg, rgba(0,0,0,.55) 0, rgba(0,0,0,0) 22px, transparent var(--row)),
    /* side shadows */
    linear-gradient(90deg, rgba(0,0,0,.45), transparent 4%, transparent 96%, rgba(0,0,0,.45)),
    /* back panel grain */
    repeating-linear-gradient(90deg, #3b2414 0 2px, #362011 2px 9px, #3e2616 9px 13px, #331e10 13px 21px);
  box-shadow: inset 0 0 40px rgba(0,0,0,.5);
}
/* Always leave one empty shelf below the last book, so the case visibly "fills up". */
.shelf::after { content: ""; flex: 0 0 100%; height: var(--row); }

.book {
  height: var(--row);
  padding-bottom: var(--plank);
  display: flex; align-items: flex-end;
  margin-right: 1px;
  perspective: 600px;
}
.spine {
  --c: #7b2d26; --t: #f3e6c8;
  position: relative;
  width: calc(var(--w, 30px) * var(--scale)); height: var(--h, 160px);
  background:
    linear-gradient(90deg, rgba(255,255,255,.0) 0%, rgba(255,255,255,.18) 18%, rgba(255,255,255,.05) 35%, rgba(0,0,0,.0) 60%, rgba(0,0,0,.28) 100%),
    var(--c);
  color: var(--t);
  border-radius: 2px 2px 1px 1px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), 2px 0 3px rgba(0,0,0,.35);
  cursor: pointer;
  border: 0; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  overflow: hidden;
  transform-origin: bottom center;
  transition: transform .18s ease, box-shadow .18s ease, opacity .25s, filter .25s;
}
.spine:hover, .spine:focus-visible {
  transform: translateY(-10px);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), 4px 6px 10px rgba(0,0,0,.5);
  outline: none; z-index: 2;
}
.spine .t {
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-size: calc(var(--fs, 13px) * (0.55 + 0.45 * var(--scale)));
  line-height: 1.1;
  flex: 0 1 auto; min-height: 0;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-height: calc(100% - 46px);
  margin-top: 14px;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
}
.spine .a {
  writing-mode: vertical-rl;
  font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase;
  opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-height: 30%; margin-bottom: 8px; flex: 0 0 auto;
}
/* spine design variants */
.spine.v1::before, .spine.v1::after {
  content: ""; position: absolute; left: 0; right: 0; height: 6px;
  border-top: 1.5px solid var(--t); border-bottom: 1.5px solid var(--t); opacity: .7;
}
.spine.v1::before { top: 6px; }
.spine.v1::after { bottom: 6px; }
.spine.v2 .t {
  background: var(--t); color: var(--c); padding: 6px 2px; border-radius: 2px;
  text-shadow: none; margin-top: 18px;
}
.spine.v3::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 22%;
  background: rgba(0,0,0,.28); border-bottom: 2px solid rgba(255,255,255,.25);
}
.spine.v3 .t { margin-top: calc(22% + 8px); max-height: calc(78% - 44px); }
.spine.v4 { border-radius: 4px 4px 1px 1px; }
.spine.v4::after {
  content: ""; position: absolute; bottom: 14px; left: 50%; width: 8px; height: 8px;
  transform: translateX(-50%) rotate(45deg); border: 1.5px solid var(--t); opacity: .7;
}
.spine.v4 .a { margin-bottom: 30px; }

.spine.dim { opacity: .18; filter: grayscale(.8); }
.spine.hit { box-shadow: 0 0 0 2px #ffd36b, 0 0 18px rgba(255,211,107,.6); }

/* new book sliding onto the shelf */
.spine.arriving { animation: arrive .9s cubic-bezier(.2,.9,.25,1.15) both; }
@keyframes arrive {
  0%   { transform: translateY(-140%) rotate(-14deg); opacity: 0; }
  55%  { transform: translateY(6px) rotate(2deg); opacity: 1; }
  75%  { transform: translateY(-4px) rotate(-1deg); }
  100% { transform: none; }
}
.spine.glow { animation: glow 2.2s ease-out 0.6s both; }
.spine.arriving.glow { animation: arrive .9s cubic-bezier(.2,.9,.25,1.15) both, glow 2.2s ease-out .9s both; }
@keyframes glow {
  0%   { box-shadow: 0 0 0 3px #ffd36b, 0 0 30px rgba(255,211,107,.9); }
  100% { box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), 2px 0 3px rgba(0,0,0,.35); }
}

/* bookend */
.bookend { height: var(--row); padding-bottom: var(--plank); display: flex; align-items: flex-end; margin-left: 4px; }
.bookend i {
  display: block; width: 16px; height: 96px;
  background: linear-gradient(90deg, #2c2c2c, #6a6a6a 40%, #3a3a3a);
  border-radius: 3px 10px 0 0;
  box-shadow: 2px 0 4px rgba(0,0,0,.5);
}

.empty-note {
  position: absolute; left: 0; right: 0; top: calc(var(--row) * .5 - 30px);
  text-align: center; color: #d9c6a8; font-family: var(--serif); font-size: 1.15rem; pointer-events: none;
}
.empty-note small { display: block; font-family: var(--sans); font-size: .85rem; color: #a8957c; margin-top: .4rem; }

/* ---------- list view ---------- */
.list-view { max-width: 1400px; margin: 0 auto; background: var(--paper); border-radius: var(--radius); overflow: auto; }
.list-view table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.list-view th, .list-view td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--paper-2); vertical-align: top; }
.list-view th { background: var(--paper-2); font-weight: 600; position: sticky; top: 0; }
.list-view tbody tr { cursor: pointer; }
.list-view tbody tr:hover { background: #fff8ec; }
.list-view td.title { font-family: var(--serif); font-weight: 600; }
.list-view td.title small { display: block; font-family: var(--sans); font-weight: 400; color: var(--muted); }
.list-view .dot { display: inline-block; width: .7em; height: 1.1em; border-radius: 2px; margin-right: .5em; vertical-align: -2px; }

/* ---------- scan button ---------- */
.scan-fab {
  position: fixed; z-index: 30;
  right: clamp(1rem, 3vw, 2.5rem); bottom: max(1.25rem, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: .6rem;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 999px; padding: .95rem 1.4rem .95rem 1.1rem;
  font-size: 1.05rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.2);
  transition: transform .15s, background .15s;
}
.scan-fab:hover { background: #9e4322; transform: translateY(-2px); }
.scan-fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ---------- dialogs ---------- */
dialog.sheet {
  border: 0; padding: 0; border-radius: 14px;
  width: min(520px, calc(100vw - 1.5rem));
  max-height: calc(100vh - 2rem);
  background: var(--paper); color: var(--ink);
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
dialog.sheet.wide { width: min(860px, calc(100vw - 1.5rem)); }
dialog::backdrop { background: rgba(15,9,5,.7); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .2s ease-out; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem .5rem; }
.sheet-head h2 { margin: 0; font-family: var(--serif); font-size: 1.35rem; }
#scanDialog > *:not(.sheet-head):not(.scan-wrap) { margin-left: 1.25rem; margin-right: 1.25rem; }
.sheet-foot { display: flex; gap: .5rem; align-items: center; padding: 1rem 1.25rem; border-top: 1px solid var(--paper-2); position: sticky; bottom: 0; background: var(--paper); }
.spacer { flex: 1; }

/* scanner */
.scan-wrap { position: relative; background: #000; margin: .25rem 0 .75rem; min-height: 240px; }
#reader { width: 100%; }
#reader video { display: block; width: 100% !important; height: auto; }
#reader img[alt="Info icon"], #reader__dashboard { display: none !important; }
.scan-hint {
  position: absolute; left: 0; right: 0; bottom: 0; padding: .6rem; text-align: center;
  color: #fff; font-size: .88rem; background: linear-gradient(transparent, rgba(0,0,0,.7));
  pointer-events: none;
}
.scan-wrap.flash::after { content: ""; position: absolute; inset: 0; background: rgba(120,255,160,.35); animation: flash .5s ease-out forwards; }
@keyframes flash { to { opacity: 0; } }
.cam-error { background: #fbecea; color: #7d1e16; padding: .7rem .9rem; border-radius: 8px; font-size: .9rem; }
.isbn-form { display: flex; gap: .5rem; }
.isbn-form input { flex: 1; padding: .6em .8em; border: 1px solid #cdbfa8; border-radius: 8px; background: #fff; font-size: 1rem; letter-spacing: .04em; }
.scan-log { list-style: none; padding: 0; margin: .75rem 1.25rem 1.25rem; display: grid; gap: .5rem; max-height: 34vh; overflow: auto; }
.scan-log li { display: flex; gap: .7rem; align-items: center; background: #fff; border: 1px solid var(--paper-2); border-radius: 8px; padding: .5rem .6rem; font-size: .9rem; }
.scan-log li img, .scan-log li .ph { width: 34px; height: 50px; object-fit: cover; border-radius: 2px; flex: none; background: var(--paper-2); }
.scan-log li .info { flex: 1; min-width: 0; }
.scan-log li .info b { display: block; font-family: var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-log li .info span { color: var(--muted); font-size: .82rem; }
.scan-log li.pending { opacity: .7; }
.scan-log li.warn { border-color: #efd28c; background: #fff9e8; }
.scan-log li.bad { border-color: #e9bdb7; background: #fdf1ef; }
.scan-log li .btn { padding: .35em .6em; font-size: .82rem; }

/* book editor */
.book-edit { display: grid; grid-template-columns: 180px 1fr; gap: 1.25rem; padding: .5rem 1.25rem 1rem; overflow: auto; max-height: calc(100vh - 11rem); }
/* a book cover: real image when we have one, otherwise a cloth binding in the spine colour */
.book-cover {
  position: relative; aspect-ratio: 2/3; border-radius: 3px 6px 6px 3px; overflow: hidden;
  background: var(--paper-2);
  box-shadow: 0 1px 2px rgba(0,0,0,.2), 0 10px 24px rgba(0,0,0,.28), 0 24px 40px -18px rgba(0,0,0,.45);
}
.book-cover::after { /* binding crease and light sheen along the spine edge */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.28) 0, rgba(255,255,255,.18) 3%, rgba(0,0,0,.12) 6%, transparent 10%);
}
.book-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.cover-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem;
  padding: 1.2rem 1rem 1.2rem 1.4rem; text-align: center; font-family: var(--serif);
  color: var(--t, #f3e6c8); background: var(--c, #7b2d26);
  box-shadow: inset 0 0 0 7px var(--c, #7b2d26), inset 0 0 0 8px color-mix(in srgb, var(--t, #f3e6c8) 55%, transparent);
}
.cover-fallback b { font-size: 1.15rem; line-height: 1.2; }
.cover-fallback span { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85; font-family: var(--sans); }

/* ---------- book info page ---------- */
#bookView .sheet-head { padding-bottom: 0; }
.book-info { display: grid; grid-template-columns: 230px 1fr; gap: 1.75rem; padding: .25rem 1.75rem 1.5rem; overflow: auto; max-height: calc(100vh - 10rem); }
.info-cover { position: sticky; top: 0; align-self: start; }
.info-body { min-width: 0; }
.genre-chip {
  display: inline-block; margin: 0 0 .6rem; padding: .25em .7em; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.info-title { margin: 0; font-family: var(--serif); font-size: 1.9rem; line-height: 1.15; }
.info-subtitle { margin: .3rem 0 0; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: #5a4a3a; }
.info-authors { margin: .6rem 0 0; font-size: 1.02rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .7rem 1rem; margin: 1.2rem 0; padding: .9rem 0; border-top: 1px solid var(--paper-2); border-bottom: 1px solid var(--paper-2); }
.facts div { min-width: 0; }
.facts dt { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: .15rem 0 0; font-size: .95rem; overflow-wrap: anywhere; }
.info-desc { font-family: var(--serif); font-size: 1rem; line-height: 1.55; position: relative; }
.info-desc p { margin: 0 0 .7em; }
.info-desc:not(.open) { max-height: 11.5rem; overflow: hidden; padding-bottom: 2rem; }
.info-desc:not(.open)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2rem; height: 3rem; background: linear-gradient(transparent, var(--paper)); }
.info-desc .more {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 1; height: 2.05rem; text-align: left;
  border: 0; background: var(--paper); color: var(--accent); font: 600 .92rem var(--sans); cursor: pointer; padding: 0;
}
.info-desc.open .more { position: static; height: auto; }
.info-notes { margin-top: 1rem; background: #fff8e6; border-left: 3px solid #d9b25b; padding: .7rem .9rem; border-radius: 0 8px 8px 0; }
.info-notes h3 { margin: 0 0 .3rem; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.info-notes p { margin: 0; }
.subject-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: 1rem 0 .5rem; }
.subject-chips span { font-size: .78rem; padding: .2em .6em; border-radius: 999px; background: var(--paper-2); color: #5a4a3a; }

/* genre divider card on the shelf (when sorted by genre) */
.book.divider { margin: 0 4px 0 6px; }
.book.divider span {
  writing-mode: vertical-rl; transform: rotate(180deg);
  min-height: 45%; max-height: 92%; padding: 10px 0; width: 22px; display: flex; align-items: center; justify-content: center;
  background: #efe4cc; color: #4a3424; border-radius: 3px 3px 0 0;
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; overflow: hidden;
  box-shadow: 2px 0 3px rgba(0,0,0,.35), inset 0 0 0 1px rgba(0,0,0,.1);
}
.swatches { display: flex; flex-wrap: wrap; gap: 5px; margin-top: .9rem; }
.swatches button { width: 22px; height: 22px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatches button.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper) inset; }
.swatches button.auto { background: conic-gradient(#7b2d26, #1f4e5f, #3d5a2a, #c89b3c, #7b2d26); font-size: 0; }
.swatches + p { margin: .35rem 0 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem .9rem; align-content: start; }
.fields .full { grid-column: 1 / -1; }
.fields label { display: grid; gap: .25rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.fields input, .fields textarea {
  font-weight: 400; font-size: .95rem; color: var(--ink);
  padding: .5em .65em; border: 1px solid #d6c8b1; border-radius: 7px; background: #fff; width: 100%;
}
.fields input[name=title] { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; }
.fields textarea { resize: vertical; }
.fields input:focus, .fields textarea:focus, .isbn-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* toasts */
.toasts { position: fixed; left: 50%; bottom: 6rem; transform: translateX(-50%); z-index: 100; display: grid; gap: .5rem; width: min(440px, calc(100vw - 2rem)); }
.toast { background: #24170e; color: var(--paper); padding: .75rem 1rem; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); display: flex; gap: .75rem; align-items: center; font-size: .92rem; animation: pop .2s ease-out; }
.toast button { margin-left: auto; background: transparent; color: #ffcf8a; border: 0; font-weight: 600; cursor: pointer; }

/* ---------- login ---------- */
body.auth { display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: min(380px, 100%); background: var(--paper); border-radius: 14px; padding: 2rem; box-shadow: 0 30px 80px rgba(0,0,0,.6); display: grid; gap: .85rem; }
.auth-card h1 { margin: 0; font-family: var(--serif); font-size: 1.8rem; }
.auth-card p { margin: 0; }
.auth-card label { display: grid; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
.auth-card input { padding: .65em .8em; border: 1px solid #d6c8b1; border-radius: 8px; font-size: 1rem; }
.auth-card .btn { justify-content: center; padding: .75em; font-size: 1rem; margin-top: .3rem; }
.auth-error { background: #fbecea; color: #7d1e16; padding: .55rem .75rem; border-radius: 8px; font-size: .9rem; }
.auth-books { display: flex; align-items: flex-end; gap: 3px; height: 54px; border-bottom: 6px solid var(--wood-light); padding-left: 4px; }
.auth-books i { display: block; width: 14px; border-radius: 2px 2px 0 0; }
.auth-books i:nth-child(1) { height: 44px; background: #7b2d26; }
.auth-books i:nth-child(2) { height: 50px; background: #1f4e5f; width: 18px; }
.auth-books i:nth-child(3) { height: 38px; background: #c89b3c; }
.auth-books i:nth-child(4) { height: 48px; background: #3d5a2a; width: 11px; }
.auth-books i:nth-child(5) { height: 42px; background: #4a3b6b; transform: rotate(12deg); transform-origin: bottom left; margin-left: 4px; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  :root { --row: 180px; --plank: 20px; --scale: .68; }
  .brand h1 { font-size: 1.3rem; }
  .tools { width: 100%; }
  .tools input[type=search] { flex: 1 1 100%; width: auto; }
  .tools .btn, .tools select { font-size: .82rem; padding: .45em .65em; }
  .bookcase { padding: 10px 8px 0; }
  .shelf { padding: 0 6px; }
  .book-edit { grid-template-columns: 1fr; max-height: calc(100vh - 10rem); }
  /* phones: cover stays on the left, title block beside it, details flow underneath */
  .book-info { display: block; padding: .25rem 1rem 1rem; max-height: calc(100vh - 9rem); }
  .info-cover { position: static; float: left; width: 118px; margin: 0 1rem .75rem 0; }
  .info-title { font-size: 1.35rem; }
  .info-subtitle { font-size: .98rem; }
  .facts { clear: both; grid-template-columns: 1fr 1fr; }
  .cover-col { display: grid; grid-template-columns: 100px 1fr; gap: .75rem; align-items: start; }
  .cover-col .swatches { margin-top: 0; }
  .cover-col p { grid-column: 2; }
  .fields { grid-template-columns: 1fr; }
  .scan-fab span { display: none; }
  .scan-fab { padding: 1rem; }
  .list-view th:nth-child(4), .list-view td:nth-child(4),
  .list-view th:nth-child(5), .list-view td:nth-child(5),
  .list-view th:nth-child(6), .list-view td:nth-child(6),
  .list-view th:nth-child(7), .list-view td:nth-child(7) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .spine.arriving, .spine.glow, dialog[open] { animation: none; }
}
