:root {
  --paper: #faf6ef;
  --card: #ffffff;
  --ink: #2a2420;
  --muted: #7d7268;
  --line: #e8dfd2;
  --red: #a8322d;
  --red-dark: #86241f;
  --green: #2f6b4f;
  --gold: #c9962b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.06), 0 4px 14px rgba(60, 40, 20, 0.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
form { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0.6em 0 0.4em; }
h2 { font-size: 1.35rem; margin: 1.6em 0 0.6em; }
h3 { font-size: 1.1rem; }
img { max-width: 100%; display: block; }
code { background: #f1ebe0; padding: 2px 6px; border-radius: 6px; font-size: 0.95em; user-select: all; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1300px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.right { text-align: right; }
.err { color: var(--red); }
.inline { display: inline; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* ---------- header ---------- */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
/* a thin folk-embroidery stripe */
/* the Hungarian tricolour as three solid bands (white bordered by the red and green) */
.site-header::before { content: ""; display: block; height: 9px; background: linear-gradient(to bottom, var(--red) 0 3px, #fff 3px 6px, var(--green) 6px 9px); }
.header-row { display: flex; align-items: center; gap: 16px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-tagline { font-family: var(--sans); font-size: 0.72rem; font-weight: 500; color: var(--muted); letter-spacing: 0.01em; margin-top: 2px; }
.nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 0.95rem; }
.nav a { color: var(--ink); }
.pill { background: var(--red); color: #fff; border-radius: 999px; font-size: 0.75rem; padding: 1px 7px; margin-left: 4px; }
.mobile-add { display: none; padding-bottom: 10px; }
@media (max-width: 700px) {
  .header-row { gap: 10px; }
  .browse-nav { order: 3; flex-basis: 100%; }
  .nav { gap: 12px; font-size: 0.9rem; }
  .mobile-add { display: block; }
}

/* ---------- forms & buttons ---------- */
input, select, textarea {
  font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; width: 100%; min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(168, 50, 45, 0.25); border-color: var(--red); }
label { display: block; font-size: 0.9rem; color: var(--muted); }
label > input, label > select, label > textarea, label > .prefixed { margin-top: 4px; color: var(--ink); }
label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); }
label.check input { width: auto; min-height: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0; background: var(--card); display: grid; gap: 12px; }
fieldset[disabled] { opacity: 0.55; }
legend { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; padding: 0 6px; }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
.row > .narrow, .narrow { flex: 0 0 110px; min-width: 90px; }
.row > .grow, .grow { flex: 3; }
.prefixed { display: flex; align-items: stretch; }
.prefixed span { display: flex; align-items: center; padding: 0 10px; background: #f1ebe0; border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; color: var(--muted); }
.prefixed input { border-radius: 0 10px 10px 0; margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600;
  padding: 10px 18px; min-height: 44px; border-radius: 999px; border: 1px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer;
}
.btn:hover { text-decoration: none; background: #f6f0e6; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { border-color: var(--line); }
.btn-small { padding: 6px 14px; min-height: 34px; font-size: 0.9rem; }
.btn-big { padding: 14px 24px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--red); cursor: pointer; }
.linklike.danger { color: var(--muted); }

.flash { padding: 12px 16px; border-radius: 10px; margin: 12px 0; background: #e9f3ec; border: 1px solid #c6dfcf; }
.flash-warn { background: #fdf4e1; border-color: #efd9a6; }
.flash-err { background: #fbe9e7; border-color: #f0c4bf; }

/* ---------- home ---------- */
.hero { text-align: center; padding: 40px 0 20px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3rem); margin-bottom: 0.2em; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 620px; margin: 0 auto 24px; }
.hero-ctas { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 28px 0; }
.steps > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px; }
.steps h3 { color: var(--red); margin-bottom: 0.2em; }
.steps p { margin-top: 0; color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font: inherit; font-size: 0.92rem; cursor: pointer; }
.chip:hover { border-color: var(--ink); text-decoration: none; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.ai:not(.on) { border-color: var(--gold); border-style: dashed; }

/* ---------- grid / cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px 16px; }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; } }
.card { display: flex; flex-direction: column; color: var(--ink); }
.card:hover { text-decoration: none; }
.card-img { position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; background: #efe7da; box-shadow: var(--shadow); }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.card:hover .card-img img { transform: scale(1.04); }
.card-body { padding: 8px 2px 0; }
.card-title { font-family: var(--serif); font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-author { color: var(--muted); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.card-seller { font-size: 0.8rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.price { font-weight: 700; }
.price.big { font-size: 1.8rem; font-family: var(--serif); }
.cond { font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: #eef4f0; color: var(--green); white-space: nowrap; }
.cond-fair, .cond-poor { background: #f6efe3; color: #8a6a2c; }
.ribbon { position: absolute; top: 10px; left: 10px; background: var(--ink); color: #fff; font-size: 0.75rem; padding: 3px 10px; border-radius: 999px; }
.ribbon.sold { background: var(--red); }
.ribbon.inline { position: static; }


/* ---------- book page ---------- */
.book { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; margin-top: 24px; }
@media (max-width: 760px) { .book { grid-template-columns: 1fr; gap: 16px; } }
.gallery #main-photo { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); background: #efe7da; max-height: 75vh; object-fit: contain; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; }
.thumb { padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; width: 64px; height: 80px; background: none; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.book-info h1 { margin-top: 0; }
.subtitle { margin-top: -0.3em; font-style: italic; }
.author { font-size: 1.1rem; color: var(--muted); }
.price-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.actions { margin: 16px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.seller-line { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.nudge { background: #fdf4e1; border-radius: 10px; padding: 10px 14px; font-size: 0.92rem; }
.description { font-family: var(--serif); font-size: 1.05rem; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 0.95rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- lists, bag, orders ---------- */
table.list { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; }
table.list td, table.list th { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: left; }
table.list tr:last-child td { border-bottom: 0; }
table.list .right { text-align: right; }
tr.unavailable { opacity: 0.5; }
tr.attention td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.tiny-img { width: 56px; }
.tiny-img img { width: 44px; height: 58px; object-fit: cover; border-radius: 6px; background: #efe7da; }
.draft-panel { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.mini-thumbs { display: flex; gap: 4px; flex: 1; overflow: hidden; }
.mini-thumbs img { width: 36px; height: 48px; object-fit: cover; border-radius: 4px; }
.bag-group h2 { margin-top: 0; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 8px 0; }
.strip-item { flex: 0 0 96px; color: var(--ink); font-size: 0.8rem; }
.strip-item img { width: 96px; height: 128px; object-fit: cover; border-radius: 8px; margin-bottom: 4px; }
.strip-item span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 0; }
.totals dd { margin: 0; text-align: right; }
.checkout { margin-top: 16px; }
.status { font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; background: #f1ebe0; white-space: nowrap; }
.status-requested, .status-paid { background: #fdf4e1; color: #8a6a2c; }
.status-accepted { background: #e7eefb; color: #2d4f8a; }
.status-shipped, .status-completed { background: #e9f3ec; color: var(--green); }
.status-declined, .status-cancelled { background: #f3efea; color: var(--muted); }
.order-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
@media (max-width: 760px) { .order-grid { grid-template-columns: 1fr; } }
.next-step { display: grid; gap: 10px; }
.next-step:empty { display: none; }
.messages { align-self: start; }
.msg { background: #f6f0e6; padding: 8px 12px; border-radius: 12px; margin-bottom: 8px; max-width: 90%; white-space: pre-wrap; }
.msg.mine { background: #eef4f0; margin-left: auto; }
.msg-meta { font-size: 0.75rem; color: var(--muted); }
address { font-style: normal; font-size: 1.05rem; line-height: 1.6; }

/* ---------- capture ---------- */
.capture { max-width: 640px; margin: 0 auto; }
.viewfinder { position: relative; aspect-ratio: 3 / 4; background: #1d1916; border-radius: 16px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewfinder:not(.live) video { display: none; }
.frame-guide { position: absolute; inset: 8% 14%; border: 2px dashed rgba(255, 255, 255, 0.45); border-radius: 8px; pointer-events: none; }
.viewfinder:not(.live) .frame-guide { display: none; }
.viewfinder.flash::after { content: ""; position: absolute; inset: 0; background: #fff; animation: flash 0.25s ease-out forwards; }
@keyframes flash { from { opacity: 0.8; } to { opacity: 0; } }
.capture-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 14px 0; }
.capture-controls .btn { font-size: 0.82rem; padding: 8px 10px; min-height: 40px; font-weight: 500; text-align: center; }
.toggle.on { background: var(--gold); border-color: var(--gold); color: #fff; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; background: var(--red); box-shadow: 0 0 0 3px var(--red), var(--shadow); cursor: pointer; }
.shutter:active { transform: scale(0.94); }
.shutter[disabled] { opacity: 0.35; }
.tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; margin: 16px 0; }
.tray-item { position: relative; background: var(--card); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.tray-item img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.tray-label { font-size: 0.72rem; padding: 4px 6px; line-height: 1.25; height: 2.9em; overflow: hidden; }
.tray-item[data-status="uploading"] img, .tray-item[data-status="pending"] img, .tray-item[data-status="running"] img { opacity: 0.6; }
.tray-item[data-status="done"] .tray-label::before { content: "✓ "; color: var(--green); }
.tray-item[data-status="error"] .tray-label { color: var(--red); }
.tray-badge { position: absolute; top: 6px; right: 6px; background: var(--gold); color: #fff; font-size: 0.7rem; padding: 1px 6px; border-radius: 999px; }

/* ---------- review ---------- */
.review-bar { position: sticky; top: 64px; z-index: 5; padding: 8px 0; background: var(--paper); }
.draft { display: grid; grid-template-columns: 150px 1fr; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 14px 0; box-shadow: var(--shadow); transition: opacity 0.3s; }
.draft.ready { border-color: #b8d6c3; }
.draft.published { display: block; opacity: 0.8; }
@media (max-width: 600px) { .draft { grid-template-columns: 1fr; } .draft-photos { flex-direction: row !important; overflow-x: auto; } .draft-photos img { width: 110px !important; } }
.draft-photos { display: flex; flex-direction: column; gap: 8px; }
.draft-photos img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; background: #efe7da; }
.draft-body { display: grid; gap: 10px; align-content: start; }
.draft fieldset { border: 0; padding: 0; background: none; }
.title-input { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.cond-pick .label { font-size: 0.9rem; color: var(--muted); display: block; margin-bottom: 4px; }
.price-pick { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.price-pick label { flex: 0 0 150px; }
.price-input { font-weight: 700; font-size: 1.1rem; }
details summary { cursor: pointer; color: var(--red); padding: 6px 0; }
details[open] { display: grid; gap: 10px; }
.draft-actions { display: flex; align-items: center; gap: 14px; justify-content: flex-end; flex-wrap: wrap; }
.draft-state { margin-right: auto; color: var(--muted); }
.draft.ready .draft-state { color: var(--green); font-weight: 600; }
.working-note { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.published-note { font-family: var(--serif); font-size: 1.1rem; color: var(--green); }

/* ---------- misc pages ---------- */
.narrow-page { max-width: 460px; margin: 24px auto; }
.narrow-page.wide-ish { max-width: 640px; }
.prose { max-width: 680px; }
ol.how { padding-left: 1.2em; }
ol.how h3 { margin-bottom: 0.2em; }
table.admin { font-size: 0.85rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 60px; padding: 20px 0 40px; color: var(--muted); font-size: 0.9rem; }
.footer-row { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-row p { margin: 4px 0; max-width: 620px; }

/* language switch */
.lang-switch { display: inline-flex; align-items: stretch; align-self: center; margin: 0; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-switch button { font: inherit; font-size: 0.8rem; font-weight: 600; line-height: 1; border: 0; background: #fff; color: var(--muted); padding: 7px 10px; cursor: pointer; }
.lang-switch button.on { background: var(--ink); color: #fff; }
.footer-links { margin: 4px 0; white-space: nowrap; }

/* ---------- browse navigation ---------- */
.browse-nav { flex: 1; display: flex; gap: 4px; }
.browse-nav a { color: var(--ink); font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.browse-nav a:hover { background: #f6f0e6; text-decoration: none; }
.browse-nav a.on { background: var(--ink); color: #fff; }

/* ---------- browse page: facet sidebar + results ---------- */
.browse { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; margin-top: 16px; }
.facets { align-self: start; position: sticky; top: 76px; max-height: calc(100vh - 90px); overflow-y: auto; padding-right: 4px; }
.facets > summary { display: none; }
.facet { border-bottom: 1px solid var(--line); padding: 10px 0 12px; }
.facet h4 { margin: 0 0 6px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.facet ul { list-style: none; margin: 0; padding: 0; }
.facet a { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--ink); font-size: 0.93rem; }
.facet a:hover { text-decoration: none; color: var(--red); }
.facet .box { width: 16px; height: 16px; border: 1.5px solid #c9bcab; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; flex: none; }
.facet a.on .box { background: var(--red); border-color: var(--red); color: #fff; }
.facet a.on { font-weight: 600; }
.facet-label { flex: 1; }
.facet-count { color: var(--muted); font-size: 0.8rem; }
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.results-head h1 { margin: 0 0 2px; }
.results-head p { margin: 0 0 12px; }
.sort label { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.sort select { width: auto; min-height: 38px; padding: 6px 10px; }
.active-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 16px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin: 32px 0 0; }
@media (max-width: 800px) {
  .browse { grid-template-columns: 1fr; gap: 8px; }
  .facets { position: static; max-height: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; }
  .facets > summary { display: flex; align-items: center; gap: 6px; padding: 12px 0; font-weight: 600; cursor: pointer; }
  .facet:last-child { border-bottom: 0; }
}

/* ---------- home: category tiles & shelves ---------- */
.cat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cat-tile { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; color: #fff; box-shadow: var(--shadow); background: #3a302a; }
.cat-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.75; transition: transform 0.3s, opacity 0.3s; }
.cat-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 35%, rgba(20, 12, 8, 0.75)); }
.cat-tile:hover { text-decoration: none; }
.cat-tile:hover img { transform: scale(1.05); opacity: 0.9; }
.cat-name { position: absolute; left: 12px; right: 40px; bottom: 10px; z-index: 1; font-family: var(--serif); font-weight: 600; font-size: 1.05rem; line-height: 1.2; }
.cat-count { position: absolute; right: 10px; bottom: 10px; z-index: 1; font-size: 0.8rem; background: rgba(255, 255, 255, 0.2); padding: 1px 8px; border-radius: 999px; }
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 160px; gap: 16px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.shelf .card { scroll-snap-align: start; }
@media (max-width: 480px) { .shelf { grid-auto-columns: 42%; } }

/* ---------- authors ---------- */
.letters { display: flex; flex-wrap: wrap; gap: 4px; position: sticky; top: 64px; background: var(--paper); padding: 10px 0; z-index: 4; }
.letters a { min-width: 36px; text-align: center; padding: 6px 8px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.letters a:hover { border-color: var(--ink); text-decoration: none; }
.author-index { columns: 3 260px; column-gap: 32px; }
.author-index section { break-inside: avoid; scroll-margin-top: 130px; }
.author-index h2 { color: var(--red); margin: 1em 0 0.3em; }
.author-index ul { list-style: none; padding: 0; margin: 0; }
.author-index li { padding: 3px 0; }

/* ---------- sellers ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; margin-top: 16px; }
.shop-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); box-shadow: var(--shadow); }
.shop-card:hover { text-decoration: none; border-color: #cdbfae; }
.mosaic { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--line); }
.mosaic img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #efe7da; }
.shop-body { padding: 10px 14px 14px; display: grid; gap: 3px; }
.shop-header { display: grid; gap: 8px; }
.shop-name { font-family: var(--serif); font-size: 1.3rem; }
.shop-body .cond { justify-self: start; }
.hint { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

/* ---- Photos of several books (shelf tiles on the capture page) ---- */
.tray-item.tray-shelf { grid-column: span 2; }
.tray-item.tray-shelf img { aspect-ratio: 4 / 3; }
.tray-item.tray-shelf .tray-label { height: auto; min-height: 2.9em; }

/* ---- Shelf drafts on the review page ---- */
.shelf-crop { width: 100%; max-height: 260px; border-radius: 8px; background-color: #efe7da; background-repeat: no-repeat; border: 2px dashed var(--line); }
.shelf-note { font-size: 0.75rem; color: var(--muted); line-height: 1.3; }
.add-photo { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; font-size: 0.85rem; cursor: pointer; }
.add-photo.primary { background: var(--red); border-color: var(--red); color: #fff; }
.add-photo.busy { opacity: 0.6; pointer-events: none; }
.photo-wrap { position: relative; }
.photo-del { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(29, 25, 22, 0.75); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.photo-del:hover { background: var(--red); }
.draft-photos .photo-wrap { flex-shrink: 0; }

/* ---- Upload / recognition progress ---- */
.tray-media { position: relative; }
.tray-overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }
.tray-item[data-status="uploading"] .tray-overlay, .tray-item[data-status="pending"] .tray-overlay, .tray-item[data-status="running"] .tray-overlay { display: flex; }
.spinner.light { width: 26px; height: 26px; border-width: 3px; border-color: rgba(255, 255, 255, 0.45); border-top-color: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }
.tray-bar { height: 4px; background: var(--line); overflow: hidden; }
.tray-bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.25s linear; }
.tray-bar.big { height: 8px; border-radius: 999px; }
.tray-bar.big i { border-radius: 999px; }
.tray-item[data-status="done"] .tray-bar i, .capture-progress:not(.busy) .tray-bar i { background: var(--green); }
.tray-item[data-status="error"] .tray-bar i { background: var(--red); width: 100% !important; }
/* moving stripes while waiting on the AI, so it never looks stuck */
.tray-item[data-status="running"] .tray-bar i, .tray-item[data-status="pending"] .tray-bar i, .capture-progress.busy .tray-bar i, .working-bar i {
  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.35) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0.35) 75%, transparent 75%);
  background-size: 16px 16px; animation: stripes 0.8s linear infinite;
}
@keyframes stripes { to { background-position: 16px 0; } }
.capture-progress { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 16px 0 0; }
.capture-progress-text { font-size: 0.88rem; font-weight: 600; margin-bottom: 6px; }
.working-note { flex-wrap: wrap; }
.working-bar { flex-basis: 100%; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.working-bar i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 999px; transition: width 0.25s linear; }
.add-photo .spinner { margin-right: 6px; border-color: rgba(255, 255, 255, 0.45); border-top-color: #fff; }
.add-photo.btn-ghost .spinner { border-color: var(--line); border-top-color: var(--red); }

/* ---- Condition explanations ---- */
.cond-desc { font-size: 0.85rem; line-height: 1.4; margin: 8px 0 0; min-height: 2.8em; color: var(--ink); }
.cond-explain { margin: 6px 0 14px; font-size: 0.9rem; line-height: 1.45; }
.cond-explain p { margin: 0 0 4px; }
.cond-notes { color: var(--muted); font-style: italic; }
.cond-guide { display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; align-items: baseline; }
.cond-guide dt { margin: 0; }
.cond-guide dd { margin: 0; }
.cond-guide .cond { font-size: 0.85rem; text-decoration: none; }
.facet h4 { display: flex; align-items: center; gap: 6px; }
.facet-help { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); font-size: 0.7rem; color: var(--muted); text-decoration: none; font-weight: 600; }
.facet-help:hover { border-color: var(--red); color: var(--red); }
.facet-hint { font-size: 0.75rem; color: var(--muted); margin: 2px 0 6px 26px; line-height: 1.35; }
@media (max-width: 600px) { .cond-guide { grid-template-columns: 1fr; gap: 4px; } .cond-guide dd { margin-bottom: 10px; } }
.cond-notes-field { margin-top: 10px; display: block; }
