/* Cozy Lavender Bookshop: warm paper, wooden shelf, lavender accents.
   Phone: one column with bottom tabs. Desktop: sticky sidebar (search, stats, nav) + shelf. */
:root {
  color-scheme: light;
  --bg: #f4ead8; --card: #fbf4e6; --sheet-bg: #f8f0e0;
  --text: #3a281b; --title: #3f2414; --muted: #75604f; --line: #e6d6bb; --line-strong: #cfb894;
  --accent: #7356a0; --accent-deep: #43305f; --on-accent: #fbf6ee; --ring: #7356a033; --lav-soft: #eee6f6; --lav-line: #d8c9ec;
  --ok: #4d6b1f; --ok-bg: #ecefd6; --ok-line: #d2dab0; --warn: #9a4a1c; --warn-bg: #f6e4d4; --danger: #a12d2d; --star: #b7791f;
  --wood: #7a4a22; --shelf: linear-gradient(#e2c9a1, #d7ba8c); --skeleton: #e6d6bb;
  --display: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --body: 'Crimson Pro', 'Iowan Old Style', Georgia, serif;
  --note: 'Caveat', 'Segoe Print', cursive;
  --r: 8px; --gutter: 16px;
  --shadow-cover: 2px 4px 8px rgba(60, 30, 10, .3);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--body); font-size: 17px; line-height: 1.45; min-height: 100dvh; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
input, select, textarea { font: inherit; color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: var(--r); z-index: 50; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- layout ---------- */
.layout { max-width: 1240px; margin: 0 auto; padding-inline: var(--gutter); padding-block: calc(20px + env(safe-area-inset-top, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)); }
.side { display: grid; gap: 14px; align-content: start; }
.main { min-width: 0; margin-top: 18px; outline: none; }
@media (min-width: 768px) {
  .layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 40px; padding-bottom: 48px; padding-top: 36px; }
  .side { position: sticky; top: 24px; max-height: calc(100dvh - 48px); overflow-y: auto; scrollbar-width: none; padding-bottom: 8px; }
  .main { margin-top: 0; }
}

.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 34px; color: var(--title); line-height: 1.05; text-wrap: balance; }
.hello { color: var(--muted); font-size: 16px; margin-top: 4px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 18px; flex: none; transition: transform .15s; }
.avatar:active { transform: scale(.94); }

/* ---------- search ---------- */
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1.5px solid var(--line-strong); border-radius: var(--r); padding: 4px 4px 4px 14px; transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 17px; height: 44px; }
.search input::placeholder { color: var(--muted); }
.scanbtn { display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 15px; transition: transform .15s; }
.scanbtn:active, .primary:active, .ghost:active { transform: scale(.96); }

.results { display: grid; gap: 8px; }
.results:empty { display: none; }
.verdict { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--r); text-align: left; width: 100%; animation: rise .28s var(--ease) both; }
.verdict.own { background: var(--ok-bg); border: 1px solid var(--ok-line); }
.verdict.no { background: var(--card); border: 1px dashed var(--line-strong); }
.verdict.wish, .verdict.sale { background: var(--lav-soft); border: 1px solid var(--lav-line); }
.verdict .head { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.verdict.own .head { color: var(--ok); }
.verdict.wish .head, .verdict.sale .head { color: var(--accent); }
.verdict small { display: block; color: var(--muted); font-size: 14px; }
.verdict .grow { flex: 1; min-width: 0; }

/* ---------- covers ---------- */
.cov { display: block; position: relative; aspect-ratio: 2 / 3; max-width: 100%; border-radius: 3px 6px 6px 3px; overflow: hidden; background: var(--skeleton); box-shadow: var(--shadow-cover); flex: none; }
.cov img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .35s; font-size: 0; }
.cov img.ld { opacity: 1; }
.cov::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.22), transparent 7%); pointer-events: none; }
.cov .spine { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 8px 6px; background: linear-gradient(160deg, var(--accent), var(--accent-deep)); color: var(--on-accent); font-family: var(--display); font-weight: 700; font-size: 13px; line-height: 1.1; overflow: hidden; }
.cov .spine small { font-family: var(--body); font-weight: 400; font-size: 11px; opacity: .85; }
.cov.sm { width: 40px; } .cov.sm .spine { font-size: 0; }
.cov.md { width: 56px; } .cov.md .spine { font-size: 9px; }
.cov.lg { width: 110px; }

/* ---------- sidebar blocks ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 6px; text-align: center; }
.stat b { display: block; font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1.1; color: var(--title); font-variant-numeric: lining-nums tabular-nums; }
.stat span { font-size: 14px; color: var(--muted); }
.now { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; background: linear-gradient(135deg, #5d4585, var(--accent-deep)); color: #f6f0fb; border-radius: var(--r); padding: 14px; transition: transform .15s; }
.now:active { transform: scale(.98); }
.now .k { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.now .t { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.1; margin: 2px 0 8px; }
.now small { font-size: 14px; opacity: .9; display: block; margin-top: 6px; }
.bar { height: 6px; border-radius: 6px; background: rgba(246, 240, 251, .25); overflow: hidden; }
.bar i { display: block; height: 100%; background: #d9c6f2; border-radius: 6px; transform-origin: left; animation: grow .9s var(--ease) both .15s; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px)); background: rgba(244, 234, 216, .94); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; font-size: 13px; font-weight: 600; color: var(--muted); border-radius: var(--r); transition: color .2s, background .2s; }
.nav button[aria-current=page] { color: var(--accent); }
@media (min-width: 768px) {
  .nav { position: static; display: grid; grid-auto-flow: row; gap: 2px; padding: 0; background: none; border: 0; backdrop-filter: none; }
  .nav button { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 46px; padding: 0 14px; font-size: 17px; }
  .nav button:hover { background: var(--card); }
  .nav button[aria-current=page] { background: var(--lav-soft); }
}

/* ---------- main views ---------- */
.view { animation: fade .25s ease-out; }
h2 { font-family: var(--display); font-weight: 700; font-size: 28px; color: var(--title); margin-bottom: 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; text-wrap: balance; }
h2 span { font-family: var(--body); font-size: 15px; font-weight: 400; color: var(--muted); }
.section + .section { margin-top: 32px; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-strong); font-size: 15px; color: var(--muted); transition: background .2s, color .2s; }
.chip[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 18px 12px; padding: 16px 12px 18px; background: var(--shelf); border-radius: var(--r); border-bottom: 10px solid var(--wood); }
@media (min-width: 700px) { .shelf { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 24px 18px; padding: 22px 20px 24px; } }
.book { position: relative; text-align: left; animation: rise .4s var(--ease) both; animation-delay: calc(min(var(--i), 20) * 35ms); transition: transform .18s var(--ease); }
.book:hover { transform: translateY(-4px); }
.book .cov { width: 100%; }
.badge { position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--bg); z-index: 1; color: #fff; }
.badge svg.i { width: 13px; height: 13px; stroke-width: 3; }
.badge.read { background: var(--ok); }
.badge.lent { background: var(--warn); }
.badge.reading { background: var(--accent); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.series { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 10px; animation: rise .35s var(--ease) both; animation-delay: calc(var(--i) * 50ms); }
.series .name { font-weight: 700; font-size: 18px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.series .name span { font-weight: 400; font-size: 15px; color: var(--muted); }
.slots { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.slot { width: 58px; }
.slot .cov { width: 100%; }
.slot .miss { aspect-ratio: 2 / 3; border: 1.5px dashed var(--line-strong); border-radius: 4px; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.slot .miss.wanted { border-color: var(--accent); color: var(--accent); background: var(--lav-soft); }
.slot .no { text-align: center; font-size: 13px; color: var(--muted); margin-top: 4px; }
.hint { font-size: 15px; color: var(--warn); margin-top: 10px; display: flex; gap: 6px; align-items: center; }

.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.item { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; animation: rise .35s var(--ease) both; animation-delay: calc(min(var(--i), 12) * 40ms); }
.item .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.item .t { font-weight: 700; font-size: 18px; line-height: 1.2; }
.item .a { font-size: 15px; color: var(--muted); }
.item .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.item.sold { opacity: .6; }
.price { font-family: var(--display); font-weight: 700; font-size: 24px; color: var(--title); font-variant-numeric: lining-nums tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; width: fit-content; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.lav { background: var(--lav-soft); color: var(--accent); }
.pill.grey { background: var(--line); color: var(--muted); }
.note-line { font-style: italic; color: var(--muted); font-size: 15px; }

.feed { display: grid; }
.ev { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); animation: rise .35s var(--ease) both; animation-delay: calc(min(var(--i), 12) * 40ms); }
.ev p { line-height: 1.35; }
.ev time { font-size: 14px; color: var(--muted); }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); background: var(--card); border: 1px dashed var(--line-strong); border-radius: var(--r); display: grid; gap: 10px; justify-items: center; }
.empty b { font-family: var(--display); font-size: 22px; color: var(--title); }

.foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; }

/* ---------- buttons & forms ---------- */
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 16px; white-space: nowrap; transition: transform .15s, opacity .2s; text-decoration: none; }
.primary.wide { width: 100%; }
.primary[disabled] { opacity: .45; cursor: not-allowed; }
.ghost { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 6px; border: 1.5px solid var(--line-strong); font-size: 15px; font-weight: 600; white-space: nowrap; transition: border-color .2s, color .2s, transform .15s; text-decoration: none; color: var(--text); }
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.ghost.danger { color: var(--danger); }
.ghost.danger.armed { background: var(--danger); border-color: var(--danger); color: #fff; }
.wa { background: #1f7a4d; }

.field { display: grid; gap: 4px; }
.field label, .lbl { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.lbl { margin: 18px 0 8px; display: block; }
.field input, .field select, .field textarea, .inline-input { width: 100%; min-height: 44px; border: 1.5px solid var(--line-strong); border-radius: 6px; padding: 8px 12px; background: var(--bg); font-size: 17px; }
.field textarea { min-height: 70px; resize: vertical; }
.field .help { font-size: 14px; color: var(--muted); }
.form { display: grid; gap: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.warnbox { background: var(--warn-bg); color: var(--warn); border-radius: var(--r); padding: 10px 12px; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.errbox { color: var(--danger); font-size: 15px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #e9e0ee; border-radius: var(--r); padding: 4px; }
.seg button { min-height: 40px; border-radius: 6px; font-weight: 600; font-size: 15px; color: var(--muted); transition: background .2s, color .2s; }
.seg button[aria-pressed=true] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.stars { display: flex; }
.stars button { width: 44px; height: 44px; display: grid; place-items: center; color: var(--line-strong); transition: transform .15s, color .15s; }
.stars button.on { color: var(--star); }
.stars button.on svg { fill: currentColor; }
.stars button:active { transform: scale(1.2); }
.stars.readonly { gap: 2px; color: var(--star); }
.stars.readonly svg { width: 16px; height: 16px; }
.lend { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lend .inline-input { flex: 1; min-width: 140px; }
.handnote { font-family: var(--note); font-size: 24px; color: var(--warn); flex: 1; line-height: 1.15; }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* ---------- sheet ---------- */
.scrim { position: fixed; inset: 0; background: rgba(30, 18, 40, .5); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 30; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--sheet-bg); border-radius: 22px 22px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateY(105%); transition: transform .3s var(--ease); z-index: 31; visibility: hidden; }
body.open .scrim { opacity: 1; pointer-events: auto; }
body.open .sheet { transform: none; visibility: visible; }
body.open { overflow: hidden; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, calc(100% - 32px)); max-height: 86dvh; border-radius: 18px; transform: translate(-50%, -46%) scale(.97); opacity: 0; transition: transform .25s var(--ease), opacity .2s; padding: 20px 26px 26px; }
  body.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
  .grab { display: none; }
}
.grab { width: 40px; height: 5px; border-radius: 5px; background: var(--line-strong); margin: 0 auto 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.sheet-head h3 { font-family: var(--display); font-weight: 700; font-size: 26px; color: var(--title); line-height: 1.1; }
.close { width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); border-radius: 50%; flex: none; }
.close:hover { background: var(--card); }
.detail { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 6px; }
.detail .grow { min-width: 0; }
.detail h3 { font-family: var(--display); font-weight: 700; font-size: 28px; color: var(--title); line-height: 1.05; text-wrap: balance; }
.detail p { color: var(--muted); font-size: 16px; margin-top: 4px; }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

.olist { display: grid; gap: 6px; margin-top: 10px; }
.opick { display: flex; gap: 12px; align-items: center; text-align: left; padding: 8px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); transition: border-color .2s; }
.opick:hover { border-color: var(--accent); }
.opick .grow { min-width: 0; }
.opick .t { font-weight: 700; line-height: 1.2; }
.opick small { color: var(--muted); font-size: 14px; }

.finder { position: relative; border-radius: 16px; overflow: hidden; background: #1c1622; min-height: 240px; display: grid; place-items: center; color: #d9c6f2; }
.finder video { width: 100% !important; display: block; }
#reader { width: 100%; }
#reader img[alt="Info icon"], #reader__dashboard_section_csr span { display: none !important; }
.scanmsg { text-align: center; color: var(--muted); margin: 12px 0; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--lav-line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }

.toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); width: min(460px, calc(100% - 32px)); background: var(--accent-deep); color: #f6f0fb; border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; opacity: 0; pointer-events: none; transition: transform .25s var(--ease), opacity .25s; z-index: 40; }
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { margin-left: auto; font-weight: 700; color: #d9c6f2; min-height: 36px; padding: 0 6px; }
@media (min-width: 768px) { .toast { bottom: 24px; } }

.loading { display: none; }
body.is-loading .loading { display: block; }
.skel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 18px; padding: 20px; background: var(--shelf); border-radius: var(--r); border-bottom: 10px solid var(--wood); }
.skel { aspect-ratio: 2 / 3; border-radius: 4px; background: linear-gradient(90deg, #e6d6bb 25%, #efe2cb 50%, #e6d6bb 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.field .search input { border: 0; background: transparent; min-height: 44px; padding: 0; }

/* ---------- phone & small tablet ---------- */
.finderbar { display: grid; gap: 8px; }
@media (max-width: 767px) {
  /* Let sidebar children join the page flow so the search bar can stick for the whole scroll */
  .side { display: contents; }
  .side > * + * { margin-top: 14px; }
  .finderbar { position: sticky; top: 0; z-index: 15; background: var(--bg); margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); padding-block: calc(8px + env(safe-area-inset-top, 0px)) 8px; transition: box-shadow .2s; }
  .finderbar.stuck { box-shadow: 0 6px 14px -8px rgba(60, 30, 10, .35); }
  .finderbar .results { max-height: 55dvh; overflow-y: auto; overscroll-behavior: contain; }
  .brand { font-size: 30px; }
  .stat { padding: 8px 4px; }
  .stat b { font-size: 24px; }
  .main { margin-top: 22px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .filters::-webkit-scrollbar { display: none; }
  .filters > * { flex: none; }
  h2 { font-size: 26px; }
}
@media (max-width: 699px) {
  .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 10px; padding: 14px 10px 16px; }
  .badge { width: 20px; height: 20px; top: -6px; right: -6px; }
  .badge svg.i { width: 11px; height: 11px; }
}
@media (max-width: 340px) {
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- cute details ---------- */
body {
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cg fill='%237356a0' opacity='.13'%3E%3Cpath d='M30 20l1.6 5 5 1.6-5 1.6-1.6 5-1.6-5-5-1.6 5-1.6z'/%3E%3Cpath d='M140 70l1.1 3.4 3.4 1.1-3.4 1.1-1.1 3.4-1.1-3.4-3.4-1.1 3.4-1.1z'/%3E%3Ccircle cx='90' cy='140' r='1.6'/%3E%3Ccircle cx='160' cy='160' r='1.2'/%3E%3Cpath d='M70 100l1.3 4 4 1.3-4 1.3-1.3 4-1.3-4-4-1.3 4-1.3z'/%3E%3C/g%3E%3C/svg%3E");
}
.brandrow { display: flex; align-items: center; gap: 10px; position: relative; min-width: 0; }
.mark { width: 48px; height: 48px; flex: none; transition: transform .3s var(--ease); }
.brandrow:hover .mark { transform: rotate(-6deg) scale(1.05); }
.twinkle { position: absolute; left: 40px; top: -4px; width: 12px; height: 12px; fill: var(--accent); opacity: .7; animation: twinkle 2.8s ease-in-out infinite; pointer-events: none; }
@keyframes twinkle { 0%, 100% { transform: scale(.6) rotate(0); opacity: .35; } 50% { transform: scale(1.1) rotate(25deg); opacity: .9; } }

h2 { justify-content: flex-start; }
h2 > span { margin-left: auto; }
.h-ic { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--lav-soft); color: var(--accent); flex: none; }
.h-ic svg.i { width: 18px; height: 18px; }

.stat { position: relative; }
.stat-ic { display: grid; place-items: center; width: 26px; height: 26px; margin: 0 auto 2px; border-radius: 50%; background: var(--lav-soft); color: var(--accent); }
.stat-ic svg.i { width: 14px; height: 14px; stroke-width: 2.4; }

.now { position: relative; overflow: hidden; }
.now .k { display: inline-flex; align-items: center; gap: 5px; }
.now .k svg.i { width: 12px; height: 12px; }
.ribbon { position: absolute; top: 0; right: 16px; width: 16px; height: 28px; fill: #d9c6f2; }

.book:hover { transform: translateY(-4px) rotate(-1.5deg); }
.decor { align-self: end; display: flex; justify-content: center; pointer-events: none; animation: rise .5s var(--ease) both .3s; }
.decor svg { width: 70%; max-width: 72px; height: auto; transform-origin: bottom center; animation: sway 5s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }

.pill svg.i { width: 13px; height: 13px; stroke-width: 2.4; }
.bag { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--lav-soft); color: var(--accent); flex: none; }
.illo { width: 140px; height: auto; }
.empty { padding-top: 28px; }

.quote { margin-top: 36px; padding: 18px 20px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start; }
.quote:empty { display: none; }
.quote > svg.i { color: var(--accent); width: 22px; height: 22px; grid-row: span 2; margin-top: 3px; }
.quote blockquote { font-family: var(--display); font-style: italic; font-weight: 600; font-size: 21px; line-height: 1.25; color: var(--title); text-wrap: balance; }
.quote figcaption { font-family: var(--note); font-size: 20px; color: var(--accent); }
.quote figcaption::before { content: '— '; }
.foot { margin-top: 20px; }

.toast > svg.i { color: #d9c6f2; }
.nav button[aria-current=page] svg { transform: translateY(-1px); }
@media (max-width: 767px) {
  .nav button { position: relative; }
  .nav button[aria-current=page]::after { content: ''; position: absolute; bottom: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
  .mark { width: 42px; height: 42px; }
  .twinkle { left: 35px; }
}

/* ---------- cover picker ---------- */
.cov-edit { position: relative; flex: none; border-radius: 6px; }
.cov-edit:hover .cov { transform: translateY(-2px); }
.cov-edit .cov { transition: transform .2s var(--ease); }
.cov-badge { position: absolute; right: -8px; bottom: -8px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); border: 3px solid var(--sheet-bg); }
.cov-badge svg.i { width: 16px; height: 16px; }
.cp-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-msg { font-size: 15px; margin: 12px 0 8px; }
.cp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px; }
.cp-opt { border-radius: 6px; padding: 0; transition: transform .15s var(--ease); animation: rise .3s var(--ease) both; }
.cp-opt img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; box-shadow: var(--shadow-cover); background: var(--skeleton); }
.cp-opt:hover { transform: translateY(-3px); }
.cp-opt[aria-pressed=true] { outline: 3px solid var(--accent); outline-offset: 3px; }
#fcp { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }

/* ---------- audit fixes ---------- */
/* Tablets and phones in landscape get the sidebar layout with a narrower sidebar */
@media (min-width: 768px) and (max-width: 1023px) {
  .layout { grid-template-columns: 280px minmax(0, 1fr); gap: 24px; padding-top: 24px; }
  .brand { font-size: 28px; }
}
@media (min-width: 768px) and (max-height: 520px) {
  .layout { padding-top: 14px; }
  .side { top: 10px; max-height: calc(100dvh - 20px); gap: 10px; }
  .hello, .stat span { display: none; }
  .stat { padding: 6px 4px; }
  .stat-ic { display: none; }
}
/* The search bar's grid column must be allowed to shrink below the input's natural width */
.finderbar { grid-template-columns: minmax(0, 1fr); }
.search input { width: 100%; }
@media (max-width: 359px) {
  .scanbtn { padding: 0 12px; }
  .scanbtn .lbl-scan { display: none; }
  .brand { font-size: 26px; }
  .mark { width: 36px; height: 36px; }
}
/* Comfortable tap targets (44px) */
.chip { min-height: 44px; }
.ghost { min-height: 44px; }
.link { min-height: 44px; display: inline-flex; align-items: center; }
/* Sold pill: readable contrast; sold cards dim the cover, not the text */
.pill.grey { background: var(--line); color: #5e4a3a; }
.item.sold { opacity: 1; }
.item.sold .cov { filter: grayscale(.9); opacity: .55; }
.item.sold .t, .item.sold .price { text-decoration: line-through; text-decoration-color: var(--muted); }
.more { font-size: 15px; color: var(--muted); padding: 2px 4px; }
@media (min-width: 768px) and (max-width: 1023px) {
  .shelf { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 18px 12px; padding: 16px 12px 18px; }
}

/* ---------- sort, password settings ---------- */
.shelf-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.shelf-tools .filters { margin-bottom: 0; flex: 1; min-width: 0; }
.sortbox { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 99px; color: var(--muted); background: var(--card); flex: none; }
.sortbox svg.i { width: 16px; height: 16px; }
.sortbox select { border: 0; background: transparent; font-size: 15px; color: var(--text); min-height: 40px; cursor: pointer; }
.sortbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
@media (max-width: 767px) {
  .shelf-tools { flex-direction: column; align-items: stretch; gap: 8px; }
  .sortbox { align-self: flex-start; }
}
.pwbox { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.pwbox summary { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; cursor: pointer; font-weight: 600; list-style: none; }
.pwbox summary::-webkit-details-marker { display: none; }
.pwbox summary::after { content: '+'; margin-left: auto; color: var(--muted); font-size: 20px; }
.pwbox[open] summary::after { content: '–'; }
.pwbox summary svg.i { color: var(--accent); width: 18px; height: 18px; }
.pwbox > *:not(summary) { margin-inline: 14px; }
.pwbox form { padding-bottom: 14px; }
.steps { margin: 10px 0 0 20px; display: grid; gap: 8px; }

/* ---------- Sarasavi results ---------- */
#sv:empty { display: none; }
#sv { display: grid; gap: 6px; }
.sv-head { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--accent); font-size: 15px; margin-top: 4px; }
.sv-head svg.i { width: 16px; height: 16px; }
.sv-head span { margin-left: auto; font-weight: 400; color: var(--muted); font-size: 13px; }
.sv-item { background: var(--card); border: 1px solid var(--line); color: var(--text); text-decoration: none; padding: 8px 12px; }
.sv-item:hover { border-color: var(--accent); }
.sv-item .t { display: block; font-weight: 600; line-height: 1.25; }
.sv-item > svg.i { color: var(--muted); width: 16px; height: 16px; }
.sv-cov { flex: none; }

/* ---------- hero: your next reads ---------- */
.hero { margin-bottom: 30px; padding: 18px; border-radius: calc(var(--r) * 2); background: linear-gradient(135deg, var(--lav-soft), var(--card) 70%); border: 1px solid var(--lav-line); position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(165, 139, 208, .25), transparent 70%); pointer-events: none; }
.hero-head { display: flex; align-items: center; gap: 10px; }
.hero-head h2 { flex: 1; margin-bottom: 12px; }
.hero-nav { display: flex; gap: 6px; margin-bottom: 12px; }
.round { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 1px solid var(--line-strong); color: var(--accent); transition: transform .15s; }
.round:hover { border-color: var(--accent); }
.round:active { transform: scale(.94); }
.hero-track { display: grid; grid-auto-flow: column; grid-auto-columns: min(330px, 84%); column-gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; padding: 4px 2px 6px; outline: none; }
.hero-track::-webkit-scrollbar { display: none; }
.hero-track:focus-visible { box-shadow: 0 0 0 3px var(--ring); border-radius: var(--r); }
.slide { scroll-snap-align: start; display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; min-width: 0; }
.cov.hero-cov { width: 92px; }
.slide-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.slide-body h3 { font-family: var(--display); font-weight: 700; font-size: 21px; line-height: 1.1; color: var(--title); text-wrap: balance; overflow-wrap: anywhere; }
.slide-body p { color: var(--muted); font-size: 15px; }
.slide-body .pill { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; }
.slide-actions { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; padding-top: 6px; }
.slide-actions .primary { min-height: 40px; padding: 0 12px; font-size: 15px; }
.slide-actions .ghost { min-height: 40px; }
@media (max-width: 767px) {
  .hero { margin-inline: calc(-1 * var(--gutter)); border-radius: 0; border-inline: 0; padding-inline: var(--gutter); }
  .hero-nav { display: none; }
  .cov.hero-cov { width: 80px; }
}

/* ---------- note from tea towel ---------- */
.note-pop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px 16px; background: rgba(43, 26, 60, .45); backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s; }
.note-pop.show { opacity: 1; }
.note-card { position: relative; width: min(360px, 100%); padding: 30px 24px 22px; text-align: center; background: var(--card); border: 2px solid var(--lav-line); border-radius: 26px; box-shadow: 0 30px 60px -20px rgba(43, 26, 60, .6); transform: translateY(24px) scale(.9) rotate(-2deg); transition: transform .5s cubic-bezier(.2, 1.4, .4, 1); }
.note-pop.show .note-card { transform: none; }
.note-cup { position: relative; width: 74px; height: 74px; margin: -66px auto 8px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); border: 5px solid var(--card); animation: wobble 2.4s ease-in-out infinite; }
.note-cup svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.steam { position: absolute; top: 8px; left: 50%; transform: translateX(-60%); display: flex; gap: 5px; }
.steam i { width: 3px; height: 10px; border-radius: 3px; background: currentColor; opacity: 0; animation: steam 2s ease-in-out infinite; }
.steam i:nth-child(2) { animation-delay: .4s; }
.steam i:nth-child(3) { animation-delay: .8s; }
@keyframes steam { 0% { opacity: 0; transform: translateY(4px); } 40% { opacity: .9; } 100% { opacity: 0; transform: translateY(-8px); } }
@keyframes wobble { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
.note-tag { display: inline-block; padding: 3px 12px; border-radius: 99px; background: var(--lav-soft); color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.mentalist .note-tag { background: #2b1a2a; color: #f4d6d6; }
.mentalist .note-tag::before { content: '☺ '; color: #e05a4a; }
.note-msg { margin: 14px 0 6px; font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.1; color: var(--title); text-wrap: balance; }
.note-sign { font-family: var(--note); font-size: 28px; color: var(--accent); line-height: 1; }
.note-ok { margin-top: 18px; min-width: 140px; }
