/* The Store tab's walk-through. Ported from the Bookstore walk (store.css) so the two match; the
   Grimmory colour tokens it read are mapped to the app's own (light and dark follow the system). */
.sw-root, .sw-dlg {
  --p-content-background: var(--bg); --p-text-color: var(--ink); --p-text-muted-color: var(--muted);
  --p-content-border-color: var(--line); --p-primary-color: var(--accent); --p-primary-contrast-color: var(--accent-ink);
  --bs-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
}
/* the walk takes the whole screen width between the sidebar or edges, no page scroll */
body.walking .app { max-width: none; padding: 0; }
body.walking { overflow: hidden; overscroll-behavior: none; }
.sw-root { position: relative; width: 100%; min-width: 0; padding-top: 10px; user-select: none; -webkit-user-select: none; }
body.desk .sw-root { padding-top: 4px; }
.sw-root .bw-top { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
body.desk .sw-root .bw-top { padding-left: 40px; padding-right: 40px; }
.sw-root .bw-chip, .sw-root .bw-top .wl-btn { font-family: var(--font); }

.wl-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 35px; padding: 0 14px;
  font: inherit; font-family: var(--font); font-size: 13px; font-weight: 600; border-radius: 999px; cursor: pointer; white-space: nowrap;
  border: 1px solid transparent; text-decoration: none; transition: background .12s, opacity .12s, border-color .12s; }
.wl-btn-primary { background: var(--accent); color: var(--accent-ink); }
.wl-btn:disabled { opacity: .45; cursor: not-allowed; }
.wl-btn-quiet { background: transparent; color: var(--muted); border-color: var(--line); }
.wl-btn-quiet:hover { color: var(--ink); border-color: var(--muted); }
.bs-error { color: var(--danger); font-weight: 600; }
.bs-empty { color: var(--muted); text-align: center; }
.bs-seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent); }
.bs-seg .wl-btn { height: 30px; padding: 0 13px; background: transparent; color: var(--ink); }
.bs-seg .wl-btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* ---- the walk-through: a modern shop you swipe through sideways ----------------------------
   Pale walls and floor follow Grimmory's light or dark theme; light oak bookcases, black steel
   signs, tables and lamps. The light changes with the time of day. */
.sw-root.bs-walking {
  --bw-bg: var(--p-content-background, #fff); --bw-ink: var(--p-text-color, #1d1c1a);
  --bw-wall: color-mix(in srgb, #c9ae86 12%, var(--bw-bg)); --bw-wall2: color-mix(in srgb, #c9ae86 18%, var(--bw-bg));
  --bw-floor: color-mix(in srgb, #8a7556 22%, var(--bw-bg)); --bw-floor2: color-mix(in srgb, #8a7556 30%, var(--bw-bg));
  /* the bookcases are lit: the same light oak and warm linen backs at every hour, so the books always
     read; only the walls, floor and windows take the time-of-day mood (dark mode dims the backs a step) */
  --bw-oak: #d3bb92; --bw-oak-d: #b39669; --bw-back: #e4d8c4; --bw-back2: #d6c8b0; --bw-steel: #1d1c1a; --bw-paper: #f4efe7;
  --bw-muted: var(--p-text-muted-color, #6a645a); --bw-gold: #c8a86a; --bw-serif: var(--bs-serif);
  --sky1: #cfe0e6; --sky2: #eef2ec; --glow: .22; --dim: 0;
  box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden;
  padding-left: 0; padding-right: 0; padding-bottom: 0; background: var(--bw-wall); color: var(--bw-ink);
}
.sw-root.bs-walking[data-time="morning"] { --sky1: #f3e3c8; --sky2: #eaf0ee; --glow: .18; }
.sw-root.bs-walking[data-time="evening"] { --sky1: #2f3a55; --sky2: #c98f6b; --glow: .6; --dim: .06; }
.sw-root.bs-walking[data-time="night"] { --sky1: #151b2b; --sky2: #2a3046; --glow: .75; --dim: .12; }
.bs-walking * { box-sizing: border-box; }
.bw-msg { padding: 40px 16px; }

.bw-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 16px 6px; }
.bw-brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bw-brand small, .bw-here small { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--bw-muted); }
.bw-brand b { font: 500 26px/1 var(--bw-serif); }
.bw-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.bw-right .bs-seg { margin: 0; }
.bw-here { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; min-width: 0; }
.bw-here span { font: italic 21px/1 var(--bw-serif); }

.bw-store { position: relative; flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; cursor: grab; outline: none; }
.bw-store::-webkit-scrollbar { display: none; }
.bw-scene { position: relative; height: 100%; }
.bw-layer { position: absolute; inset: 0; pointer-events: none; }
.bw-layer > * { pointer-events: auto; position: absolute; }
.bw-fg { will-change: transform; }
.bw-wall { left: 0; right: 0; top: 0; bottom: var(--fl); background: linear-gradient(var(--bw-wall2), var(--bw-wall) 30%); }
.bw-wall::after { content: ""; position: absolute; inset: 0; background: #1a140c; opacity: var(--dim); }
.bw-floor { left: 0; right: 0; bottom: 0; height: var(--fl); background: linear-gradient(var(--bw-floor), var(--bw-floor2));
  border-top: 1px solid rgba(0, 0, 0, .08); }
.bw-lamp { top: 0; width: 2px; height: 14px; background: var(--bw-steel); pointer-events: none !important; }
.bw-lamp::after { content: ""; position: absolute; left: -11px; top: 14px; width: 24px; height: 11px; border-radius: 14px 14px 3px 3px; background: var(--bw-steel); }
.bw-lamp::before { content: ""; position: absolute; left: -40px; top: 24px; width: 82px; height: 60px;
  background: radial-gradient(50% 60% at 50% 0, rgba(255, 214, 150, var(--glow)), transparent 70%); }

.bw-door { bottom: var(--fl); width: 110px; height: calc(var(--bay) + 40px); border: 5px solid var(--bw-steel); border-bottom: 0;
  background: linear-gradient(180deg, var(--sky1), var(--sky2)); opacity: .9; }
.bw-door::after { content: ""; position: absolute; right: 12px; top: 50%; width: 4px; height: 44px; background: var(--bw-steel); border-radius: 2px; }
.bw-window { bottom: var(--fl); width: 300px; height: calc(var(--bay) + 10px); border: 6px solid var(--bw-steel); border-bottom: 0; }
.bw-glass { position: absolute; inset: 0; background: linear-gradient(180deg, var(--sky1), var(--sky2)); opacity: .95; }
.bw-lettering { position: absolute; left: 0; right: 0; top: 16px; text-align: center; font: italic 24px/1.1 var(--bw-serif); color: var(--bw-gold);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .25); padding: 0 10px; }
.bw-lettering small { display: block; font: 10px/1 system-ui, sans-serif; letter-spacing: .3em; text-transform: uppercase; margin-bottom: 6px; }
.bw-plinths { position: absolute; left: 12px; right: 12px; bottom: 0; display: flex; align-items: flex-end; justify-content: center; gap: 10px; }
.bw-plinth { display: flex; flex-direction: column; align-items: center; }
.bw-plinth > i { display: block; width: 84px; background: color-mix(in srgb, #ede6da 85%, var(--bw-bg)); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .06); }
.bw-plinth .bw-face { margin: 0 0 -1px; }
.bw-welcome { top: clamp(50px, 16%, 140px); width: 220px; display: flex; flex-direction: column; gap: 10px; }
.bw-welcome small { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--bw-muted); }
.bw-welcome h2 { margin: 0; font: 500 44px/.95 var(--bw-serif); }
.bw-welcome p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--bw-muted); }

.bw-sign { top: 0; display: flex; flex-direction: column; align-items: center; transform: translateX(-50%); z-index: 1; }
.bw-sign > i { display: block; width: 1px; height: 6px; background: var(--bw-steel); opacity: .7; }
.bw-sign > div { background: var(--bw-steel); color: var(--bw-paper); padding: 6px 20px 8px; border-radius: 3px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; box-shadow: 0 8px 18px rgba(0, 0, 0, .12); white-space: nowrap; max-width: calc(var(--bw) - 20px); }
.bw-sign small { font-size: 10px; letter-spacing: .24em; text-transform: uppercase; opacity: .75; }
.bw-sign b { font: 500 24px/1 var(--bw-serif); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.bw-bay { bottom: calc(var(--fl) - 6px); width: var(--bw); height: var(--bay); background: var(--bw-oak); border-radius: 3px 3px 0 0;
  padding: 8px 8px 0; display: flex; flex-direction: column; box-shadow: 0 18px 30px -18px rgba(0, 0, 0, .35); }
.bw-bay::after { content: ""; position: absolute; left: -4px; right: -4px; bottom: 0; height: 10px; background: var(--bw-oak-d); }
.bw-row { position: relative; flex: 1; min-height: 0; background: linear-gradient(var(--bw-back), var(--bw-back2)); display: flex; align-items: flex-end; gap: 1px; padding: 0 6px;
  border-bottom: 6px solid var(--bw-oak); box-shadow: inset 0 8px 12px -10px rgba(0, 0, 0, .14); }
.bw-row:last-child { border-bottom-width: 16px; }
.bw-low { padding-bottom: 56px; }   /* the books sit above the reading chairs in front */
.bw-low .bw-row { justify-content: center; gap: 10px; }
.bw-gap { flex: none; width: 10px; }
.bw-row.bw-covers { justify-content: space-evenly; }   /* a full row of standalone covers */
.bw-covers .bw-gap { display: none; }
.bw-spine { position: relative; flex: none; border: 0; padding: 0; border-radius: 1.5px 1.5px 0 0; cursor: pointer; display: flex; align-items: center;
  justify-content: center; overflow: hidden; background: var(--c, #444); color: #f6f1e8; transition: transform .2s;
  box-shadow: inset -2px 0 0 rgba(0, 0, 0, .14), inset 2px 0 0 rgba(255, 255, 255, .06); }
.bw-spine::after { content: ""; position: absolute; left: 0; right: 0; top: 8%; height: 1px; background: rgba(255, 255, 255, .25); }
.bw-spine span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: var(--sf, 14px); font-weight: 600; letter-spacing: .01em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-height: 86%; text-shadow: 0 1px 1px rgba(0, 0, 0, .4); }
.bw-num span { max-height: calc(100% - var(--sf, 14px) - 20px); margin-bottom: calc(var(--sf, 14px) + 4px); }
.bw-two span { white-space: normal; text-overflow: clip; line-height: 1.18; font-size: calc(var(--sf, 14px) - 1px); text-align: center; max-width: 100%; }
.bw-tight span { font-size: max(11.5px, calc(var(--sf, 14px) - 2.5px)); letter-spacing: 0; }
.bw-spine i { position: absolute; bottom: 5px; left: 0; right: 0; text-align: center; font: 700 max(12px, calc(var(--sf, 14px) - 2px))/1 system-ui, sans-serif; font-style: normal; opacity: .9; }
.bw-spine:hover, .bw-spine:focus-visible, .bw-face:hover, .bw-face:focus-visible, .bw-parcel:hover, .bw-parcel:focus-visible { transform: translateY(-6px); }
.bw-face { position: relative; flex: none; border: 0; padding: 6px; margin: 0 4px; cursor: pointer; border-radius: 2px; overflow: hidden; display: flex;
  flex-direction: column; justify-content: flex-end; text-align: left; color: #fff; box-shadow: 0 6px 10px -4px rgba(0, 0, 0, .35); transition: transform .2s; }
.bw-face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.bw-face.bw-has img { opacity: 1; }
.bw-face-t { display: flex; flex-direction: column; gap: 2px; }
.bw-face-t b { font: 600 14px/1.1 var(--bw-serif); }
.bw-face-t i { font-style: normal; font-size: 12px; opacity: .85; }
.bw-has > .bw-face-t { visibility: hidden; }

.bw-table { bottom: 14px; height: 58px; background: var(--bw-steel); border-radius: 2px; z-index: 2; }
.bw-table::before, .bw-table::after { content: ""; position: absolute; bottom: -14px; width: 4px; height: 14px; background: var(--bw-steel); }
.bw-table::before { left: 12px; } .bw-table::after { right: 12px; }
.bw-table-top { position: absolute; left: 10px; right: 10px; bottom: 58px; display: flex; align-items: flex-end; justify-content: center; gap: 10px; }
.bw-table-top .bw-face { margin: 0; }
.bw-table-sign { position: absolute; left: 50%; bottom: 9px; transform: translateX(-50%); color: var(--bw-paper); font-size: 10px; letter-spacing: .24em;
  text-transform: uppercase; white-space: nowrap; text-align: center; }
.bw-table-sign b { display: block; font: italic 500 21px/1.1 var(--bw-serif); letter-spacing: 0; text-transform: none; margin-top: 2px; }
.bw-parcel { position: relative; flex: none; border: 0; padding: 8px 6px; cursor: pointer; border-radius: 2px; background: #c9a77a; color: #3a2a18;
  display: flex; align-items: center; justify-content: center; text-align: center; font: italic 14px/1.1 var(--bw-serif);
  box-shadow: 0 6px 10px -4px rgba(0, 0, 0, .35); transition: transform .2s; }
.bw-parcel::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: #8e2f2f; opacity: .85; }
.bw-parcel::after { content: ""; position: absolute; left: 0; right: 0; top: 34%; height: 3px; background: #8e2f2f; opacity: .85; }
.bw-parcel span { position: relative; z-index: 1; background: #f4ebdd; padding: 4px 6px; border-radius: 2px; transform: rotate(-3deg); }

.bw-plant { bottom: 10px; width: 46px; height: 120px; z-index: 2; pointer-events: none !important; }
.bw-pot { position: absolute; bottom: 0; left: 6px; width: 34px; height: 36px; background: var(--bw-steel); border-radius: 2px 2px 6px 6px; }
.bw-leaf { position: absolute; bottom: 30px; width: 22px; height: 54px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #4e6b52; transform-origin: bottom center; }
.bw-chair { bottom: 10px; width: 92px; height: 84px; z-index: 2; pointer-events: none !important; }
.bw-chair-seat { position: absolute; bottom: 14px; left: 0; right: 0; height: 30px; border-radius: 14px; background: #7d8e7a; }
.bw-chair-back { position: absolute; bottom: 36px; left: 6px; right: 6px; height: 46px; border-radius: 18px 18px 8px 8px; background: #8e9f8a; }
.bw-win { top: 56px; width: 120px; bottom: var(--fl); border: 6px solid var(--bw-steel); border-bottom: 0; background: linear-gradient(180deg, var(--sky1), var(--sky2)); opacity: .9; }
.bw-win::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: var(--bw-steel); }
.bw-counter { bottom: 10px; width: 360px; height: 100px; z-index: 2; background: var(--bw-steel); border: 0; border-radius: 3px 3px 0 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; color: var(--bw-paper); cursor: pointer; font: inherit; }
.bw-counter::before { content: ""; position: absolute; left: -10px; right: -10px; top: -8px; height: 8px; background: var(--bw-oak); border-radius: 2px; }
.bw-counter small { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; opacity: .75; }
.bw-counter b { font: 500 22px/1.1 var(--bw-serif); }
.bw-bell { position: absolute; top: -26px; right: 30px; width: 22px; height: 14px; border-radius: 12px 12px 2px 2px; background: var(--bw-gold); }

.bw-foot { flex: none; padding: 10px 0 calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid rgba(127, 120, 108, .18); background: var(--bw-wall); }
.bw-track { height: 2px; margin: 0 16px; background: rgba(127, 120, 108, .25); border-radius: 2px; overflow: hidden; }
.bw-track i { display: block; height: 100%; width: 0; background: var(--bw-ink); }
.bw-chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px; scrollbar-width: none; }
.bw-chips::-webkit-scrollbar { display: none; }
.wl-btn.bw-chip { flex: none; height: 40px; padding: 0 15px; border-radius: 999px; border: 1px solid rgba(127, 120, 108, .35); background: transparent;
  color: var(--bw-ink); font-size: 14px; white-space: nowrap; }
.wl-btn.bw-chip[aria-current="true"] { background: var(--bw-ink); color: var(--bw-bg); border-color: var(--bw-ink); }

.bw-foot-row { display: flex; align-items: center; gap: 4px; padding-right: 16px; }
.bw-foot-row .bw-chips { flex: 1; min-width: 0; }
.bw-tote { position: relative; flex: none; width: 50px; height: 50px; border-radius: 50%; border: 0;
  background: var(--bw-steel); color: var(--bw-paper); display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .25); transition: transform .25s; }
.bw-tote svg { width: 24px; height: 24px; }
.bw-tote.bw-bump { transform: scale(1.12); }
.bw-tote-n { position: absolute; top: -2px; right: -2px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--bw-gold); color: #1d1c1a;
  font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.bw-tote-n[hidden] { display: none; }
.bw-flyer { position: fixed; z-index: 40; border-radius: 3px; pointer-events: none; transition: transform .6s cubic-bezier(.5, 0, .2, 1), opacity .6s;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .3); }

/* holding a book */
dialog.bw-hand { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px)); background: rgba(24, 21, 18, .88); color: #f4efe7; overflow-y: auto; box-sizing: border-box;
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
dialog.bw-hand[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
dialog.bw-hand::backdrop { background: transparent; }
.bw-hand * { box-sizing: border-box; }
.bw-stage { perspective: 1400px; flex: none; position: relative; z-index: 0; }
.bw-book { position: relative; width: min(58vw, 230px, 34vh); aspect-ratio: 2 / 3; transform-style: preserve-3d; cursor: pointer;
  transition: transform .6s cubic-bezier(.3, .7, .2, 1); }
.bw-book.bw-flipped { transform: rotateY(180deg); }
.bw-side { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; border-radius: 3px 6px 6px 3px; overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .45), inset 4px 0 0 rgba(0, 0, 0, .18); }
.bw-front { display: flex; flex-direction: column; justify-content: flex-end; padding: 16px; color: #fff; }
.bw-front img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bw-front .bw-face-t b { font-size: 24px; }
.bw-front .bw-face-t i { font-size: 12px; }
.bw-front.bw-has > .bw-face-t { visibility: hidden; }
.bw-back { transform: rotateY(180deg); padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; color: #f6f1e8; overflow-y: auto; }
.bw-back small { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; opacity: .75; }
.bw-back p { margin: 0; font: 15.5px/1.4 var(--bs-serif); white-space: pre-line; }
.bw-by { margin-top: auto; font-size: 12px; opacity: .8; }
.bw-wrap { background: #c9a77a; display: flex; align-items: center; justify-content: center; padding: 18px; text-align: center; color: #3a2a18;
  font: italic 21px/1.25 var(--bs-serif); white-space: pre-line; }
.bw-wrap::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 6px; margin-left: -3px; background: #8e2f2f; }
.bw-wrap::after { content: ""; position: absolute; left: 0; right: 0; top: 26%; height: 6px; background: #8e2f2f; }
.bw-wrap span { position: relative; z-index: 1; background: #f4ebdd; padding: 12px 14px; border-radius: 3px; transform: rotate(-2deg); box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.bw-cap { text-align: center; display: flex; flex-direction: column; gap: 4px; max-width: 360px; }
.bw-cap h2 { margin: 0; font: 500 28px/1.05 var(--bs-serif); color: #f4efe7; }
.bw-cap p { margin: 0; font-size: 14px; color: rgba(244, 239, 231, .75); }
.bw-acts { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 420px; }
.bw-acts .wl-btn { min-height: 44px; border-radius: 999px; padding: 0 18px; display: inline-flex; align-items: center; text-decoration: none; font-size: 14px; }
dialog.bw-hand .bw-acts .wl-btn-quiet, dialog.bw-hand .bw-acts .wl-btn-quiet:hover, dialog.bw-hand .bw-acts .wl-btn-quiet:focus {
  background: #34302b; color: #f4efe7; border: 1px solid rgba(244, 239, 231, .6); }
dialog.bw-hand .bw-acts .wl-btn:focus-visible { outline: 2px solid #f4efe7; outline-offset: 2px; }
.bw-acts .wl-btn-primary { background: #f4efe7; color: #1d1c1a; border: 1px solid #f4efe7; }
dialog.bw-hand .bw-acts .wl-btn.bw-done { background: #b9cdb9; border-color: #b9cdb9; color: #1d1c1a; }
.bw-note { min-height: 18px; margin: 0; font-size: 14px; color: rgba(244, 239, 231, .85); text-align: center; }
.wl-btn.bw-x { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; width: 44px; height: 44px; padding: 0; border-radius: 50%;
  border: 1px solid rgba(244, 239, 231, .3); background: transparent; color: #f4efe7; display: flex; align-items: center; justify-content: center; }
.bw-x svg { width: 20px; height: 20px; }

/* the tote and the receipt */
dialog.bw-drawer { position: fixed; top: auto; bottom: 0; left: 0; right: 0; margin: 0 auto; width: min(520px, 100vw); max-width: none; max-height: 82vh;
  border: 0; border-radius: 22px 22px 0 0; padding: 20px 20px calc(22px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; box-sizing: border-box;
  background: var(--p-content-background, #fff); color: var(--p-text-color, #1d1c1a); box-shadow: 0 -10px 30px rgba(0, 0, 0, .18); }
dialog.bw-drawer[open] { display: flex; flex-direction: column; gap: 14px; }
dialog.bw-drawer::backdrop { background: rgba(20, 18, 16, .4); }
.bw-drawer h2 { margin: 0; font: 500 28px/1.1 var(--bs-serif); }
.bw-drawer > .wl-btn { min-height: 46px; border-radius: 999px; font-size: 15px; }
.bw-list { display: flex; flex-direction: column; gap: 10px; }
.bw-item { display: flex; align-items: center; gap: 12px; }
.bw-item > i { flex: none; width: 40px; height: 60px; border-radius: 2px; }
.bw-item > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bw-item b { font-size: 15px; font-weight: 600; }
.bw-item small { font-size: 13px; color: var(--p-text-muted-color, #6a645a); }
.bw-empty { margin: 0; color: var(--p-text-muted-color, #6a645a); font-size: 15px; line-height: 1.5; }
.bw-receipt { font: 13px/1.6 ui-monospace, Menlo, Consolas, monospace; background: #fbf8f2; color: #2a2622; padding: 16px 18px; border-radius: 4px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .12); }
.bw-receipt hr { border: 0; border-top: 1px dashed #9a9184; margin: 8px 0; }
.bw-r { display: flex; justify-content: space-between; gap: 10px; }
.bw-c { text-align: center; }

/* the bookseller: a quiet "ask" in the top line, a card that drops below it, and the book it finds
   lifts off the shelf with a gold edge for a moment */
.wl-btn.bw-ask, .bw-ask { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px 0 13px; border-radius: 999px;
  border: 1px solid rgba(127, 120, 108, .4); background: color-mix(in srgb, var(--bw-bg) 55%, transparent); color: var(--bw-ink); cursor: pointer;
  font: italic 16px/1 var(--bw-serif); white-space: nowrap; transition: border-color .15s, background .15s; }
.bw-ask:hover, .bw-ask[aria-expanded="true"] { border-color: var(--bw-ink); background: var(--bw-bg); }
.bw-ask:focus-visible { outline: 2px solid var(--bw-ink); outline-offset: 2px; }
.bw-ask svg { width: 18px; height: 18px; flex: none; }
.bw-askp { position: absolute; right: 16px; z-index: 30; width: min(420px, calc(100% - 32px)); max-height: calc(100% - 90px); display: flex; flex-direction: column;
  gap: 10px; padding: 16px 16px 12px; border-radius: 16px; background: var(--bw-bg); color: var(--bw-ink); border: 1px solid rgba(127, 120, 108, .28);
  box-shadow: 0 22px 50px -12px rgba(0, 0, 0, .35); user-select: text; -webkit-user-select: text; animation: bw-drop .18s ease-out; }
body.desk .bw-askp { right: 40px; }
@keyframes bw-drop { from { opacity: 0; transform: translateY(-6px); } }
.bw-askp-hd { position: relative; display: flex; flex-direction: column; gap: 3px; padding-right: 40px; }
.bw-askp-hd small { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--bw-muted); }
.bw-askp-hd b { font: 500 22px/1.1 var(--bw-serif); }
.wl-btn.bw-askp-x { position: absolute; top: -4px; right: -4px; width: 38px; height: 38px; padding: 0; border-radius: 50%; background: transparent; color: var(--bw-muted); }
.wl-btn.bw-askp-x:hover { color: var(--bw-ink); }
.bw-askp-x svg { width: 18px; height: 18px; }
.bw-askp-in { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(127, 120, 108, .4);
  background: var(--bw-wall); color: var(--bw-muted); }
.bw-askp-in:focus-within { border-color: var(--bw-ink); }
.bw-askp-in svg { width: 18px; height: 18px; flex: none; }
.bw-askp-in input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--bw-ink); font: 16px/1.2 var(--font, system-ui, sans-serif); outline: none; }
.bw-askp-out { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -6px; padding: 0 6px; overscroll-behavior: contain; }
.bw-askp-hint, .bw-askp-say { margin: 6px 2px; font-size: 14px; line-height: 1.45; color: var(--bw-muted); }
.bw-askp-say { color: var(--bw-ink); font: italic 15.5px/1.4 var(--bw-serif); margin-top: 10px; }
.bw-hit { display: flex; align-items: center; gap: 12px; width: 100%; padding: 7px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--bw-ink);
  text-align: left; cursor: pointer; font: inherit; text-decoration: none; }
.bw-hit:hover, .bw-hit:focus-visible { background: color-mix(in srgb, var(--bw-ink) 7%, transparent); outline: none; }
.bw-hit-c { flex: none; width: 34px; height: 51px; border-radius: 2px; box-shadow: 0 3px 6px -2px rgba(0, 0, 0, .35); }
.bw-hit-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bw-hit-t b { font-size: 15px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bw-hit-t small { font-size: 13px; color: var(--bw-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bw-hit-w { flex: none; max-width: 42%; font: italic 14px/1.2 var(--bw-serif); color: var(--bw-muted); text-align: right; }
.bw-away .bw-hit-w { color: var(--bw-ink); }
.bw-askp-far { display: flex; flex-direction: column; gap: 14px; padding: 8px 2px 6px; }
.bw-askp-far p { margin: 0; font: 500 21px/1.3 var(--bw-serif); }
.bw-askp-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.bw-askp-acts .wl-btn { height: 42px; padding: 0 18px; font-size: 14px; }
.bw-askp-acts .wl-btn-primary { background: var(--bw-ink); color: var(--bw-bg); }
.bw-askp-wish { align-self: flex-start; margin: 8px 2px 2px; font-size: 14px; font-weight: 600; color: var(--bw-ink); text-decoration: underline;
  text-decoration-color: rgba(127, 120, 108, .6); text-underline-offset: 3px; }
.bw-askp-wish.bw-askp-wish-go { text-decoration: none; display: inline-flex; align-items: center; height: 42px; padding: 0 18px; border-radius: 999px;
  background: var(--bw-ink); color: var(--bw-bg); }
.bw-spine.bw-found, .bw-face.bw-found { transform: translateY(-14px); z-index: 2; outline: 3px solid var(--bw-gold); outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(200, 168, 106, .35), 0 14px 22px -8px rgba(0, 0, 0, .45); animation: bw-found 1.1s ease-in-out 3; }
@keyframes bw-found { 50% { box-shadow: 0 0 0 12px rgba(200, 168, 106, .12), 0 14px 22px -8px rgba(0, 0, 0, .45); } }
@media (max-width: 480px) {
  .bw-ask { width: 36px; height: 36px; padding: 0; justify-content: center; }
  /* with the ask button and the floor switch, "you're in" gives way rather than run into them */
  .sw-root .bw-brand { flex: 1 1 0; min-width: 60px; }
  .bw-right { flex: 0 1 auto; }
  .bw-here { flex: 0 1 auto; min-width: 0; max-width: 30vw; overflow: hidden; }
  .bw-right .bw-here span { max-width: 100%; }
  .bw-ask span { display: none; }
  .bw-askp { right: 8px; left: 8px; width: auto; padding: 14px 12px 10px; }
  .bw-hit-w { max-width: 38%; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .bw-askp, .bw-spine.bw-found, .bw-face.bw-found { animation: none; }
}

@media (max-width: 480px) {
  /* one slim line on a phone so the bookcase gets the height */
  .sw-root { padding-top: 4px; }
  .bw-top { padding-bottom: 4px; gap: 8px; }
  .bw-brand small, .bw-here small { display: none; }
  .bw-brand { flex: 1 1 auto; }
  .bw-brand { min-width: 0; }
  .bw-brand b { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bw-right { flex-wrap: nowrap; gap: 8px; min-width: 0; }
  .bw-here span { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; display: block; }
  .bw-right .bs-seg { flex: none; flex-wrap: nowrap; }
  .bw-right .bs-seg .wl-btn { height: 28px; padding: 0 10px; }
  .bw-right .wl-btn-quiet:not(.bw-arr) { display: none; }
  .bw-right .bw-arr { height: 30px; padding: 0 10px; font-size: 13px; }
  .bw-foot { padding-top: 6px; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .bw-book, .bw-spine, .bw-face, .bw-parcel, .bw-tote, .bw-flyer { transition: none; }
}

/* dark: the steel tote button and tables need an edge to stand off the dark floor */
@media (prefers-color-scheme: dark) {
  .sw-root.bs-walking { --bw-back: #c7b89e; --bw-back2: #b6a588; }
  .sw-root .bw-tote { box-shadow: 0 0 0 1px rgba(244, 239, 231, .35), 0 10px 24px rgba(0, 0, 0, .4); }
}

/* "Already on Kobo": a state, not a button */
.bw-state { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 6px; font-size: 14px; font-weight: 600; color: #b9cdb9; }
.bw-state[hidden] { display: none; }
.bw-state svg { width: 18px; height: 18px; flex: none; }
.bw-item small.bw-on { color: #3f6b46; font-weight: 600; }
.bw-drawer .bw-state-c { justify-content: center; margin: 0; min-height: 0; color: #3f6b46; }
@media (prefers-color-scheme: dark) {
  .bw-item small.bw-on, .bw-drawer .bw-state-c { color: #9fc4a3; }
}

/* previous / next while holding a book */
dialog.bw-hand .bw-step { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid rgba(244,239,231,.35); background: rgba(29,28,26,.55); color: #f4efe7; display: grid; place-items: center; cursor: pointer; padding: 0; z-index: 2; }
dialog.bw-hand .bw-step svg { width: 22px; height: 22px; }
dialog.bw-hand .bw-step:disabled { opacity: .25; cursor: default; }
dialog.bw-hand .bw-step:focus-visible { outline: 2px solid #f4efe7; outline-offset: 2px; }
dialog.bw-hand .bw-prev { left: max(12px, env(safe-area-inset-left, 0px)); }
dialog.bw-hand .bw-next { right: max(12px, env(safe-area-inset-right, 0px)); }
dialog.bw-hand .bw-where { margin: 0; font-size: 13px; color: rgba(244,239,231,.7); }
@media (max-width: 600px) { dialog.bw-hand .bw-step { top: auto; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: none; } }

/* stepping between held books: a short slide with a turn, like taking the next book off the shelf */
dialog.bw-hand .bw-stage.bw-out-next { animation: bwOutNext .17s ease-in forwards; }
dialog.bw-hand .bw-stage.bw-out-prev { animation: bwOutPrev .17s ease-in forwards; }
dialog.bw-hand .bw-stage.bw-in-next { animation: bwInNext .32s cubic-bezier(.2,.8,.2,1); }
dialog.bw-hand .bw-stage.bw-in-prev { animation: bwInPrev .32s cubic-bezier(.2,.8,.2,1); }
dialog.bw-hand .bw-cap.bw-fade-out { animation: bwFadeOut .17s ease-in forwards; }
dialog.bw-hand .bw-cap.bw-fade-in { animation: bwFadeIn .32s ease-out; }
@keyframes bwOutNext { to { transform: translateX(-60px) rotateY(18deg) scale(.94); opacity: 0; } }
@keyframes bwOutPrev { to { transform: translateX(60px) rotateY(-18deg) scale(.94); opacity: 0; } }
@keyframes bwInNext { from { transform: translateX(70px) rotateY(-20deg) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bwInPrev { from { transform: translateX(-70px) rotateY(20deg) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bwFadeOut { to { opacity: 0; transform: translateY(4px); } }
@keyframes bwFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { dialog.bw-hand .bw-stage, dialog.bw-hand .bw-cap { animation: none !important; } }

/* Arrange (admin) */
dialog.bw-arrange { max-width: 640px; width: calc(100vw - 32px); max-height: 86vh; overflow: auto; padding: 22px 20px 18px; border: 0; border-radius: 18px; background: var(--surface); color: var(--ink); }
dialog.bw-arrange::backdrop { background: rgba(20,18,16,.55); }
.bw-ar-h { margin: 0 40px 10px 0; font-size: 22px; }
.bw-ar-sec { border-top: 1px solid var(--line-soft); padding: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.bw-ar-sec h3 { margin: 0; font-size: 16px; }
.bw-ar-sub { margin: 0; font-size: 13px; color: var(--muted); }
.bw-ar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bw-ar-t { flex: 1 1 160px; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.bw-ar-in { font: inherit; font-size: 15px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); min-width: 0; flex: 1 1 200px; }
.bw-ar-find { display: flex; flex-direction: column; gap: 6px; }
.bw-ar-res { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); }
.bw-ar-pick { font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-align: left; max-width: 100%; overflow-wrap: anywhere; }
dialog.bw-arrange .bw-acts { display: flex; gap: 10px; margin-top: 10px; }
.bw-ar-sec > .bw-ar-in, .bw-ar-find > .bw-ar-in { flex: none; width: 100%; box-sizing: border-box; }
