/* Dog-Eared Books - styles.
   Fonts: the page works with the fonts already on the visitor's device. To use the original look,
   download Fredoka and Nunito (free, SIL Open Font License), put the .woff2 files in a "fonts" folder
   and remove the comment marks around the block below.

@font-face { font-family: "Fredoka"; src: local("Fredoka"), url(fonts/fredoka.woff2) format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Nunito";  src: local("Nunito"),  url(fonts/nunito.woff2)  format("woff2"); font-weight: 200 1000; font-display: swap; }
*/
/* Layout: sticky shop bar, sunny intro with age tiles as the main filter, then a grid of book covers. Detail sheet, cart drawer and admin dialogs sit on top. */
:root {
  --bg: #eef5ff;
  --surface: #ffffff;
  --fg: #1b2440;
  --muted: #55627f;
  --line: #c9d9f2;
  --edge: #1b2440;
  --accent: #2a6fdb;
  --accent-fg: #ffffff;
  --sun: #ffd23f;
  --sun-fg: #2a2100;
  --danger: #b3261e;
  --c-baby: #ff7a66; --on-baby: #2a0f0a;
  --c-little: #ffd23f; --on-little: #2a2100;
  --c-mid: #2fc29a; --on-mid: #05261d;
  --c-teen: #7449e0; --on-teen: #ffffff;
  --c-adult: #1b2440; --on-adult: #ffffff;
  --f-display: "Fredoka", "Nunito", ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --f-body: "Nunito", ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1730; --surface: #18224a; --fg: #eaf0ff; --muted: #a5b3d9; --line: #2b3a6e; --edge: #4a5fa8;
    --accent: #7fb0ff; --accent-fg: #0a1430; --danger: #ff8a80; --c-adult: #3a4a86;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1730; --surface: #18224a; --fg: #eaf0ff; --muted: #a5b3d9; --line: #2b3a6e; --edge: #4a5fa8;
  --accent: #7fb0ff; --accent-fg: #0a1430; --danger: #ff8a80; --c-adult: #3a4a86;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--f-body); font-size: 17px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 56px;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; line-height: 1.1; }
p { margin: 0; }
.wrap { max-width: 74rem; margin-inline: auto; }

/* shop bar */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); border-bottom: 2px solid var(--line); }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; }
.brand { font-family: var(--f-display); font-weight: 700; font-size: 1.55rem; letter-spacing: -.01em; line-height: 1; }
.brand small { display: block; font-family: var(--f-body); font-weight: 700; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.bar-actions { display: flex; gap: 8px; align-items: center; }
.cart-btn {
  display: inline-flex; align-items: center; gap: 8px; background: var(--fg); color: var(--bg);
  border: 0; border-radius: 999px; padding: 9px 16px; font-family: var(--f-display); font-weight: 600;
}
.cart-btn .n { background: var(--sun); color: var(--sun-fg); border-radius: 999px; padding: 0 8px; font-size: .9rem; min-width: 1.7em; text-align: center; }
.pill { background: transparent; border: 2px solid var(--line); border-radius: 999px; padding: 7px 14px; font-family: var(--f-display); font-weight: 500; font-size: .95rem; }
.pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }

/* intro */
.intro { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: center; padding-block: 32px 20px; }
.intro h1 { font-size: clamp(2.2rem, 6.4vw, 3.8rem); font-weight: 700; letter-spacing: -.02em; max-width: 14ch; }
.intro p { color: var(--muted); font-size: 1.15rem; margin-top: 12px; max-width: 34rem; }

/* age tiles */
.ages { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 12px; padding-bottom: 20px; }
.age {
  border: 2px solid var(--edge); border-radius: 18px; padding: 12px 14px; text-align: left; display: grid; gap: 2px;
  background: var(--tile, var(--surface)); color: var(--on, var(--fg)); box-shadow: 3px 3px 0 var(--edge);
  min-width: 0;
}
.age b { font-family: var(--f-display); font-size: 1.7rem; font-weight: 700; line-height: 1; }
.age span { font-size: .85rem; font-weight: 700; line-height: 1.25; }
.age small { font-size: .78rem; font-weight: 600; opacity: .8; }
.age[aria-pressed="true"] { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--edge); outline: 3px solid var(--accent); outline-offset: 3px; }
.age[data-age="baby"] { --tile: var(--c-baby); --on: var(--on-baby); }
.age[data-age="little"] { --tile: var(--c-little); --on: var(--on-little); }
.age[data-age="mid"] { --tile: var(--c-mid); --on: var(--on-mid); }
.age[data-age="teen"] { --tile: var(--c-teen); --on: var(--on-teen); }
.age[data-age="adult"] { --tile: var(--c-adult); --on: var(--on-adult); }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding-block: 8px 12px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > label, .lab { font-weight: 800; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 9px 12px; min-width: 0; width: 100%;
}
.search { flex: 1 1 14rem; }
.sel { flex: 0 1 11.5rem; }
.count { font-weight: 700; font-size: .9rem; color: var(--muted); padding-bottom: 10px; }

/* grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.75rem, 1fr)); gap: 30px 20px; padding-block: 12px 28px; }
.card { display: flex; flex-direction: column; gap: 12px; min-width: 0; position: relative; }
.card.sold .cover { filter: grayscale(.9); opacity: .65; }
.cover-btn { padding: 0; border: 0; background: none; display: block; border-radius: 6px; }
.cover {
  position: relative; aspect-ratio: 2 / 3; width: 100%; max-width: 100%; overflow: hidden; border-radius: 6px 14px 14px 6px;
  border: 2px solid var(--edge); box-shadow: 4px 4px 0 var(--edge); container-type: inline-size;
}
.cover .ci { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 9cqw 10cqw 10cqw 14cqw; text-align: left; }
.cover::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 5cqw; background: linear-gradient(90deg, rgba(0,0,0,.25), rgba(0,0,0,0)); }
.cover svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cover .ca { font-weight: 800; font-size: 6.4cqw; letter-spacing: .05em; text-transform: uppercase; }
.cover .ct { font-family: var(--f-display); font-weight: 700; font-size: 13cqw; line-height: 1; text-wrap: balance; }
.cover.photo { padding: 0; background: var(--surface); }
.cover.photo::after { display: none; }
.cover.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.info h3 { font-size: 1.1rem; font-weight: 600; line-height: 1.2; height: 3.6em; overflow: hidden; }
.info h3 .linklike { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; width: 100%; overflow-wrap: anywhere; }
.info .by { line-height: 1.35; height: 2.7em; overflow: hidden; }
.info .meta { line-height: 1.3; height: 2.6em; overflow: hidden; }
.linklike { background: none; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; }
.linklike:hover { text-decoration: underline; text-underline-offset: 3px; }
.by { color: var(--muted); font-size: .95rem; font-weight: 600; }
.meta { font-size: .78rem; font-weight: 700; color: var(--muted); }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; }
.price { font-family: var(--f-display); font-weight: 600; font-size: 1.3rem; }
.grade { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 800; }
.notches { display: inline-flex; gap: 2px; }
.notches i { width: 6px; height: 13px; border: 2px solid var(--fg); border-radius: 3px; display: block; }
.notches i.on { background: var(--fg); }
.btn {
  background: var(--accent); color: var(--accent-fg); border: 2px solid var(--accent); border-radius: 999px; padding: 10px 20px;
  font-family: var(--f-display); font-weight: 600; font-size: 1rem;
}
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.small { padding: 6px 14px; font-size: .92rem; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn[disabled] { opacity: .5; cursor: default; }
.add { margin-top: 8px; background: transparent; border: 2px solid var(--fg); border-radius: 999px; padding: 7px 12px; font-family: var(--f-display); font-weight: 600; font-size: .95rem; }
.add:hover:not([disabled]) { background: var(--fg); color: var(--bg); }
.add[disabled] { border-color: var(--line); color: var(--muted); cursor: default; }
.badge { position: absolute; top: 8px; left: -4px; z-index: 2; background: var(--danger); color: #fff; font-weight: 800; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; padding: 3px 10px; border-radius: 0 999px 999px 0; }
.empty { grid-column: 1 / -1; padding: 40px 0; display: grid; gap: 12px; justify-items: start; color: var(--muted); }

/* admin */
.adm { display: none; }
body.admin .adm { display: inline-flex; }
.adminbar { background: var(--sun); color: var(--sun-fg); border-bottom: 2px solid var(--edge); }
.adminbar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding-block: 10px; }
.adminbar .msg { flex: 1 1 14rem; font-weight: 700; font-size: .92rem; }
.adminbar .btn { background: var(--sun-fg); border-color: var(--sun-fg); color: var(--sun); }
.adminbar .btn.ghost { background: transparent; color: var(--sun-fg); border-color: var(--sun-fg); }
.edit-link { margin-top: 4px; }

/* sections below the grid */
.section { border-top: 2px solid var(--line); padding-block: 32px; }
.section h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: 18px; }
.guide { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 20px 28px; margin: 0; }
.guide div { display: grid; gap: 6px; align-content: start; }
.guide dt { font-family: var(--f-display); font-weight: 600; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }
.guide dd { margin: 0; color: var(--muted); }
.terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 24px; }
.terms h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 6px; }
.terms p { color: var(--muted); }
.fine { font-size: .82rem; font-weight: 700; color: var(--muted); padding-top: 12px; }

/* dialogs */
dialog { background: var(--surface); color: var(--fg); border: 2px solid var(--edge); border-radius: 20px; padding: 0; max-width: 100vw; }
dialog::backdrop { background: rgba(10, 16, 40, .6); }
.sheet { width: min(48rem, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; }
.d-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 12px 0 24px; }
.d-top h2 { font-size: 1.4rem; font-weight: 700; }
.x { background: var(--bg); border: 2px solid var(--line); border-radius: 999px; width: 38px; height: 38px; display: grid; place-items: center; flex: none; margin-left: auto; }
.d-body { display: flex; flex-wrap: wrap; gap: 24px 28px; padding: 8px 24px 26px; align-items: flex-start; }
.d-gallery { flex: 0 0 auto; width: 16rem; max-width: 100%; display: grid; gap: 10px; }
.g-main { position: relative; width: 16rem; height: 24rem; max-width: 100%; border: 2px solid var(--edge); border-radius: 6px 14px 14px 6px; box-shadow: 4px 4px 0 var(--edge); overflow: hidden; background: var(--bg); touch-action: pan-y; }
.g-main > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.g-main .cover { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border: 0; box-shadow: none; border-radius: 0; }
.g-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 999px; border: 2px solid var(--edge); background: var(--surface); display: grid; place-items: center; z-index: 2; font-size: 1.4rem; line-height: 1; padding: 0 0 3px; }
.g-nav.prev { left: 6px; }
.g-nav.next { right: 6px; }
.g-cap { font-weight: 800; font-size: .82rem; color: var(--muted); text-align: center; }
.g-thumbs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.g-thumb { width: 3.2rem; height: 4.8rem; padding: 0; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); flex: none; }
.g-thumb[aria-current="true"] { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.g-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.plist { display: grid; gap: 10px; }
.pitem { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); gap: 12px; align-items: center; border: 2px solid var(--line); border-radius: 14px; padding: 8px; }
.pitem .pt { width: 3.4rem; height: 5.1rem; border-radius: 6px; overflow: hidden; background: var(--bg); border: 2px solid var(--line); }
.pitem .pt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pitem > div:last-child { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pitem .row { display: contents; }
.pitem select { padding: 5px 8px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); width: auto; }
a.btn { text-decoration: none; display: inline-block; }
.stack { flex: 1 1 16rem; min-width: 0; display: grid; gap: 14px; align-content: start; }
.stack h2 { font-size: 2rem; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: .98rem; }
.specs dt { font-weight: 800; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 4px; }
.specs dd { margin: 0; min-width: 0; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; }
.flag { font-size: .78rem; font-weight: 800; border: 2px dashed var(--muted); border-radius: 999px; padding: 1px 10px; color: var(--muted); }
.pencil { font-family: var(--f-display); font-size: 2rem; font-weight: 700; }
.pencil small { font-family: var(--f-body); font-size: .8rem; color: var(--muted); font-weight: 700; margin-left: 8px; }

.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; height: 100dvh; max-height: none; width: min(28rem, 100vw); border-radius: 0; border-width: 0 0 0 2px; overflow: auto; }
.drawer-in { display: grid; gap: 18px; padding: 20px 22px calc(28px + env(safe-area-inset-bottom, 0px)); padding-right: max(22px, env(safe-area-inset-right, 0px)); padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.drawer h2 { font-size: 1.7rem; font-weight: 700; }
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) auto; gap: 12px; align-items: center; padding-block: 12px; border-bottom: 2px solid var(--line); }
.lines .cover { width: 3.4rem; height: 5.1rem; aspect-ratio: auto; box-shadow: 2px 2px 0 var(--edge); border-width: 1.5px; }
.lines .cover .ca, .lines .cover .ct { display: none; }
.lines .t { font-family: var(--f-display); font-weight: 600; line-height: 1.2; }
.lines .s { font-size: .85rem; color: var(--muted); font-weight: 600; }
.lines .right { display: grid; gap: 4px; justify-items: end; }
.rm { background: none; border: 0; padding: 0; color: var(--danger); font-weight: 800; font-size: .8rem; text-decoration: underline; text-underline-offset: 2px; }
.totals { display: grid; gap: 4px; font-weight: 700; }
.totals div { display: flex; justify-content: space-between; gap: 12px; }
.totals .grand { font-family: var(--f-display); font-size: 1.3rem; padding-top: 8px; border-top: 2px solid var(--line); margin-top: 4px; }
.form { display: grid; gap: 12px; }
.hint { font-size: .92rem; color: var(--muted); font-weight: 600; }
.summary { font-size: .85rem; line-height: 1.5; min-height: 14rem; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.ed { padding: 8px 24px 24px; display: grid; gap: 14px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; font-size: .92rem; text-transform: none; letter-spacing: 0; color: var(--fg); }
.checks input { width: auto; }
.photo-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.photo-row .thumb { width: 4.5rem; flex: none; }
.photo-row .thumb .cover { width: 4.5rem; height: 6.75rem; aspect-ratio: auto; }

@media (max-width: 40rem) { .d-gallery, .g-main { width: min(16rem, 100%); } .d-gallery { margin-inline: auto; } .g-main { height: 22rem; } body { font-size: 16px; } .stack h2 { font-size: 1.7rem; } }
@media (prefers-reduced-motion: no-preference) {
  .age, .btn, .add, .pill { transition: transform .12s, box-shadow .12s, background-color .15s, color .15s; }
}

/* admin extras */
.adminbar .btn[disabled] { opacity: .55; }
.dot { display: inline-block; min-width: 1.5em; padding: 0 6px; border-radius: 999px; background: var(--sun-fg); color: var(--sun); font-size: .78rem; margin-left: 6px; text-align: center; }
a.btn { text-decoration: none; display: inline-block; }
noscript p, .fatal { padding: 24px; font-weight: 700; }

/* photo names, progress dialog, import notes */
.pname { flex: 1 1 100%; margin: 0; font-size: .82rem; font-weight: 600; color: var(--muted); overflow-wrap: anywhere; }
.pname b { color: var(--fg); }
.pname .was { font-weight: 600; }
.badge.need { background: var(--sun); color: var(--sun-fg); }
.chk { display: flex; gap: 8px; align-items: flex-start; font-weight: 700; font-size: .95rem; margin: 8px 0; text-transform: none; letter-spacing: 0; color: var(--fg); }
.chk input { width: auto; margin-top: .3rem; flex: none; }
#taskBar { width: 100%; height: 14px; accent-color: var(--accent); }
.tlog { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .92rem; font-weight: 600; }
.tlog ul { margin: 6px 0 0; padding-left: 1.1rem; }
.tlog ul li { margin: 4px 0; }
.tlog .btn { margin-left: 6px; }

.copies { border-top: 2px dashed var(--line, #c9d3ee); padding-top: .75rem; }
.copies h4 { margin: 0 0 .4rem; font-size: .95rem; }
.copies ul { list-style: none; margin: 0 0 .4rem; padding: 0; display: grid; gap: .3rem; }
.copies .linklike { text-decoration: underline; font-weight: 700; }

.zoomable { cursor: zoom-in; }
.results { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .35rem; }
.results .pick { width: 100%; text-align: left; padding: .55rem .75rem; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); font: inherit; color: inherit; cursor: pointer; }
.results .pick:hover, .results .pick:focus-visible { border-color: var(--accent); }
.results .pick small { display: block; color: var(--muted); font-weight: 700; margin-top: .15rem; }
dialog.viewer { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(8, 12, 28, .97); color: #fff; overflow: hidden; }
dialog.viewer[open] { display: flex; flex-direction: column; }
dialog.viewer::backdrop { background: #000; }
.v-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; }
.v-cap { margin: 0; font-weight: 800; }
.v-stage { position: relative; flex: 1 1 auto; min-height: 0; }
.v-scroll { position: absolute; inset: 0; overflow: hidden; display: flex; touch-action: pan-y; }
.v-scroll img[data-vzoom] { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.v-stage.zoomed .v-scroll { overflow: auto; touch-action: auto; }
.v-stage.zoomed .v-scroll img[data-vzoom] { position: static; inset: auto; height: auto; max-width: none; max-height: none; flex: none; margin: auto; cursor: zoom-out; }
.v-stage .g-nav { width: 52px; height: 52px; font-size: 2rem; background: rgba(255,255,255,.92); color: #1b2440; }
.v-stage .g-nav.prev { left: 12px; } .v-stage .g-nav.next { right: 12px; }
.v-thumbs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: .6rem 1rem 0; }
.v-hint { margin: 0; padding: .5rem 1rem .8rem; text-align: center; font-size: .8rem; opacity: .75; }
dialog.viewer .x { background: rgba(255,255,255,.92); color: #1b2440; }

details.blurb { border: 2px solid var(--line); border-radius: 12px; padding: .15rem .9rem; background: var(--surface); }
details.blurb summary { cursor: pointer; font-weight: 800; padding: .55rem 0; }
details.blurb[open] summary { border-bottom: 2px dashed var(--line); margin-bottom: .5rem; }
details.blurb p { margin: 0 0 .7rem; }
a.ol { font-weight: 700; color: var(--accent); }

/* the book panel hangs from the top, so its top bar never moves whatever the content height */
#detail { margin: 3vh auto auto; max-height: calc(100dvh - 3vh - 12px); }
#detail .d-top { position: sticky; top: 0; z-index: 3; background: var(--surface); }
.copies > .by { margin: 0 0 .6rem; }
.copies ul { gap: .5rem; }
.copy { display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; padding: .5rem .7rem; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; font: inherit; list-style: none; }
button.copy { cursor: pointer; }
button.copy:hover, button.copy:focus-visible { border-color: var(--accent); background: var(--bg); }
.copy.here { border-color: var(--accent); background: var(--bg); }
.copy-thumb { flex: none; display: block; }
.copy-thumb .cover { width: 3.4rem; height: 5.1rem; aspect-ratio: auto; box-shadow: 2px 2px 0 var(--edge); border-width: 1.5px; }
.copy-thumb .cover .ca, .copy-thumb .cover .ct { display: none; }
.copy-text { flex: 1 1 auto; min-width: 0; display: grid; gap: .1rem; }
.copy-main { font-size: 1rem; }
.copy-text small { color: var(--muted); font-weight: 700; font-size: .78rem; line-height: 1.3; }
.copy-go, .copy-tag { flex: none; font-weight: 800; font-size: .8rem; padding: .3rem .7rem; border-radius: 999px; }
.copy-go { border: 2px solid var(--accent); color: var(--accent); }
.copy-tag { background: var(--accent); color: var(--accent-fg); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.req { border: 2px solid var(--line); border-radius: 14px; padding: .8rem 1rem; margin: 0 0 .8rem; background: var(--surface); display: grid; gap: .35rem; }
.req header { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.req p, .req ul { margin: 0; } .req ul { padding-left: 1.1rem; display: grid; gap: .2rem; }
.req .ra { color: var(--muted); }
.rstate { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: .1rem .5rem; border-radius: 999px; background: var(--bg); border: 1.5px solid var(--accent); color: var(--accent); }
.rstate.sold { border-color: var(--muted); color: var(--muted); } .rstate.free { border-color: var(--line); color: var(--muted); }
.sync { border: 2px dashed var(--accent); border-radius: 12px; padding: .7rem 1rem; margin-bottom: .8rem; display: grid; gap: .5rem; }
.sync p { margin: 0; }

[hidden] { display: none !important; }

/* next / previous book inside the age group; fixed widths so the top bar never moves between books */
#detail .d-top .meta { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bnav { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.bnav .btn { min-width: 40px; white-space: nowrap; }
.bpos { font-size: .85rem; min-width: 5.5em; text-align: center; color: var(--muted); white-space: nowrap; }
@media (max-width: 560px) { .bnav .bl { display: none; } .bpos { min-width: 4.2em; } }

/* ---------- admin extras: review queue, table, photo tools, backups, sales ---------- */
.sheet.wide { width: min(78rem, calc(100vw - 24px)); }
.warn { margin: 0; padding: 8px 12px; border-radius: 10px; border: 2px solid var(--sun); background: color-mix(in srgb, var(--sun) 22%, var(--surface)); font-weight: 700; font-size: .92rem; }
.bk-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; flex-basis: 100%; padding-top: 6px; font-weight: 700; }
.adminbar .wrap { flex-wrap: wrap; }
.rv-filters { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.rv-filters .chk { margin: 2px 0; }
.rv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
@media (max-width: 720px) { .rv-grid { grid-template-columns: 1fr; } }
.rv-photo { display: grid; gap: 8px; justify-items: center; }
.rv-photo .rv-main { border: 0; padding: 0; background: var(--bg); border-radius: 12px; cursor: zoom-in; width: 100%; display: grid; place-items: center; min-height: 12rem; }
.rv-photo .rv-main img { max-width: 100%; max-height: 52vh; object-fit: contain; border-radius: 10px; }
.rv-thumbs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.rv-thumbs button { border: 2px solid var(--line); border-radius: 8px; padding: 0; width: 52px; height: 52px; overflow: hidden; background: var(--bg); }
.rv-thumbs button[aria-current="true"] { border-color: var(--accent); }
.rv-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.rv-form { display: grid; gap: 10px; }
.rv-form .fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chip { background: var(--sun); color: var(--sun-fg); border-radius: 999px; padding: 2px 10px; font-weight: 800; font-size: .8rem; }
.tbl-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.tbl-tools input[type="search"] { flex: 1 1 14rem; min-width: 0; }
.tbl-bulk { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 12px; border: 2px solid var(--accent); border-radius: 12px; background: var(--surface); position: sticky; top: 0; z-index: 2; }
.tbl-bulk .bk { display: inline-flex; gap: 6px; align-items: center; }
.tbl-bulk input { width: 7.5rem; }
.tbl-wrap { overflow-x: auto; border: 2px solid var(--line); border-radius: 12px; }
.tbl { border-collapse: collapse; width: 100%; min-width: 52rem; font-size: .92rem; }
.tbl th { text-align: left; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px; border-bottom: 2px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.tbl td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.attn td:first-child { box-shadow: inset 4px 0 0 var(--sun); }
.tbl tr.sold { opacity: .6; }
.tbl input, .tbl select { width: 100%; min-width: 0; font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); }
.tbl input[type="checkbox"] { width: auto; }
.tbl td.th { width: 44px; } .tbl td.th img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; display: block; background: var(--bg); }
.tbl td.num { white-space: nowrap; color: var(--muted); font-weight: 700; }
.tbl td.pr { width: 6rem; }
.pe-stage { display: grid; place-items: center; background: var(--bg); border-radius: 12px; padding: 8px; }
.pe-wrap { position: relative; display: inline-block; line-height: 0; touch-action: none; cursor: crosshair; max-width: 100%; }
.pe-wrap canvas { max-width: 100%; max-height: 56vh; border-radius: 6px; }
.pe-crop { position: absolute; border: 2px dashed #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.5); pointer-events: none; }
.sales-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 10px; }
.sales-sum div { border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.sales-sum b { display: block; font-size: 1.4rem; font-family: var(--f-display); }
.sales-sum span { color: var(--muted); font-weight: 700; font-size: .82rem; }
.stbl { border-collapse: collapse; width: 100%; font-size: .92rem; }
.stbl th { text-align: left; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--line); }
.stbl td { padding: 5px 8px; border-bottom: 1px solid var(--line); }
.stbl td.r, .stbl th.r { text-align: right; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 16px; }
.vlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.vlist li { display: flex; gap: 10px; align-items: center; justify-content: space-between; border: 2px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.photo-tools { display: inline-flex; gap: 4px; }

/* sale + recently added strips */
.strips { padding-block: 4px 0; }
.strip { margin-block: 14px 6px; }
.strip-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.strip-h h2 { font-family: var(--f-display); font-size: 1.35rem; margin: 0; }
.strip-row { display: flex; gap: 16px; overflow-x: auto; padding: 8px 2px 14px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.scard { flex: 0 0 8.25rem; scroll-snap-align: start; display: flex; flex-direction: column; gap: 6px; min-width: 0; position: relative; }
.scard .cover-btn { position: relative; }
.scard h3 { font-size: .9rem; line-height: 1.25; margin: 0; }
.scard .price { font-size: 1.05rem; margin: 0; }
.badge.sale { background: #d6336c; color: #fff; }
.scard .badge { position: absolute; top: 6px; left: 6px; }
.price s.was { font-weight: 400; font-size: .8em; opacity: .65; margin-right: 2px; }
.price.sale .now { color: #c2255c; }
@media (prefers-color-scheme: dark) { .price.sale .now { color: #ff8fb3; } }

/* optional pictures from the theme/ folder (banner, background, logo, details) */
.brand .logo { display: block; height: 2.6rem; width: auto; max-width: 28vw; flex: none; object-fit: contain; }
.brand.has-logo { display: flex; align-items: center; gap: 12px; }
.brand-text { min-width: 0; }
.banner { padding-top: 16px; }
.banner img { display: block; width: 100%; max-height: 18rem; object-fit: cover; border: 2px solid var(--edge); border-radius: 14px; }
.info-img { display: block; width: 100%; max-height: 16rem; object-fit: cover; border: 2px solid var(--edge); border-radius: 14px; margin-bottom: 22px; }
body.has-bg::after { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--theme-bg) center / cover no-repeat; }
body.has-bg #main { background: color-mix(in srgb, var(--bg) 90%, transparent); border-radius: 16px; margin-block: 12px; padding-inline: 20px; }

.age.sale-tile { --tile: #d6336c; --on: #fff; }

/* grouped admin bar */
.ab-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary::after { content: " \25BE"; }
.menu-list { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; min-width: 14rem; display: grid; gap: 2px; padding: 6px; background: var(--surface); border: 2px solid var(--edge); border-radius: 12px; box-shadow: 4px 4px 0 var(--edge); }
.menu-list .mi { text-align: left; background: none; border: 0; border-radius: 8px; padding: 10px 12px; font: inherit; font-weight: 700; color: var(--fg); cursor: pointer; }
.menu-list .mi:hover, .menu-list .mi:focus-visible { background: var(--bg); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.sync { font-size: .8rem; font-weight: 700; color: var(--muted); }
.sync.bad { color: var(--danger); }
/* publish dialog */
.pub-state { padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); margin-bottom: 14px; }
.pub-state b { font-weight: 800; }
.pub-sched { display: grid; gap: 8px; margin: 14px 0; padding: 12px; border: 2px dashed var(--line); border-radius: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
span.chip { cursor: default; }
.chip.live { background: #2fc29a; border-color: #2fc29a; color: #0b2b22; }
.chip.sched { background: #ffd23f; border-color: #ffd23f; color: #3a2e00; }
.vlist2 { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.vlist2 li { padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; display: grid; gap: 6px; }
.vlist2 li.is-live { border-color: #2fc29a; }
.vlist2 .vtop { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.vlist2 small { color: var(--muted); }
#pubDlg details.other { margin-top: 14px; border-top: 2px solid var(--line); padding-top: 10px; }
#pubDlg details.other summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.pub-msg { min-height: 1.4em; margin: 8px 0; font-weight: 700; }
.pub-msg.bad { color: var(--danger); }
