/* Dogear app 1.5.6 — layout: one phone-width column, content scrolls, tab bar + mini player fixed at the bottom */
html, body { background: var(--surface-000); }
body { margin: 0; color: var(--ink); font-family: var(--font-sans); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
.app { min-height: 100vh; min-height: 100dvh; background: var(--surface-000); color: var(--ink); }
.app-main { max-width: 560px; margin: 0 auto; padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.app.has-mini .app-main { padding-bottom: calc(176px + env(safe-area-inset-bottom, 0px)); }
.app.is-full .app-main { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }
.app-screen { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.app-pad { padding-inline: 16px; }
.app-pad.app-screen { padding-top: calc(24px + env(safe-area-inset-top, 0px)); }
.app-loading { min-height: 60vh; display: grid; place-items: center; }
.app-display { margin: 0; font: 400 40px/44px var(--font-sans); letter-spacing: -.015em; text-wrap: balance; }
.app-title { margin: 0; font: 500 26px/32px var(--font-sans); letter-spacing: -.01em; text-wrap: balance; }
.app-h2, .app-section-head h2, .app-empty h2 { margin: 0; font: 500 19px/24px var(--font-sans); }
.app-muted { color: var(--ink-muted); margin: 0; }
.app-small { font-size: 13px; line-height: 18px; }
.app-center { text-align: center; }
.app-error { color: var(--negative); margin: 0; font-size: 14px; }
.app-grow { flex: 1; }
.app-selfcenter { align-self: center; }
.app-textlink { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 8px 0; font: 400 12px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); cursor: pointer; }
.app-iconlink { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; border-radius: 50%; color: inherit; cursor: pointer; }
.app-iconlink-spacer { width: 44px; height: 44px; }
.app-iconlink:focus-visible, .app-tile:focus-visible, .app-continue:focus-visible, .app-genrecard:focus-visible, .app-srcrow:focus-visible, .app-drop:focus-visible, .app-chapterbtn:focus-visible, .app-listrow:focus-visible, .app-upnext:focus-visible, .app-tocrow:focus-visible, .app-addbtn:focus-visible, .app-textlink:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* top bar */
.app-topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 0; position: relative; z-index: 2; }
.app-topbar-title { color: var(--ink); }

/* home hero */
.app-hero { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; min-height: 236px; padding: calc(40px + env(safe-area-inset-top, 0px)) 20px 22px; border-radius: 0 0 28px 28px; box-sizing: border-box; }
.app-on-grad { color: #1d1c1a; }
.app-hero .dg-label.app-on-grad { opacity: .72; }
[data-theme="dark"] .app-on-grad { color: #f2f0ea; }
.app-hero-top { display: flex; flex-direction: column; gap: 8px; }
.app-hero-stats { display: flex; gap: 32px; }
.app-hero-stats > div { display: flex; flex-direction: column; gap: 2px; }
.app-stat { font: 400 28px/32px var(--font-sans); color: #1d1c1a; font-variant-numeric: tabular-nums; }
[data-theme="dark"] .app-stat { color: #f2f0ea; }
.app-stat small { font-size: 13px; opacity: .7; margin-left: 4px; }
.app-hero-sticker { position: absolute; right: 22px; bottom: 26px; }
[data-theme="eink"] .app-hero { border: 2px solid #000; border-top: 0; }

/* continue card */
.app-continue { margin: 0 16px; display: flex; gap: 14px; align-items: stretch; padding: 14px; border: 0; border-radius: var(--radius-lg); background: var(--surface-100); box-shadow: var(--shadow-card); text-align: left; cursor: pointer; }
.app-continue-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.app-continue-meta .dg-progress { margin-top: auto; }
.app-continue-title { font: 500 18px/22px var(--font-sans); }
.app-continue-play { align-self: center; width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--ink-inverse); }
[data-theme="eink"] .app-continue { border: 2px solid #000; }

/* sections + rows */
.app-section, .app-shelf { display: flex; flex-direction: column; gap: 12px; }
.app-section { padding-inline: 16px; }
.app-section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.app-shelf-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-row { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x proximity; margin-inline: -16px; padding: 4px 16px 10px; scrollbar-width: none; }
.app-row::-webkit-scrollbar { display: none; }
.app-tile { flex: none; scroll-snap-align: start; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; border-radius: var(--radius-sm); }
.app-bleed { margin-inline: -16px; padding-inline: 14px; }
.app-titlerow { display: flex; justify-content: space-between; align-items: center; }
.app-addbtn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--ink); color: var(--ink-inverse); display: grid; place-items: center; cursor: pointer; }

/* empty */
.app-empty { margin: 8px 16px; padding: 28px 20px; border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.app-empty p { margin: 0 0 6px; color: var(--ink-muted); max-width: 32ch; line-height: 1.45; }
.app-pad .app-empty { margin-inline: 0; }

/* search */
.app-list { display: flex; flex-direction: column; gap: 14px; }
.app-listrow { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.app-genregrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
.app-genrecard { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-md); background: var(--surface-100); cursor: pointer; font-weight: 500; }

/* you */
.app-yourstats { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.app-yourstats-side { display: flex; flex-direction: column; gap: 14px; }
.app-goal { display: flex; justify-content: space-between; align-items: center; }
.app-stepper { display: flex; align-items: center; gap: 14px; }
.app-stepper-val { font: 400 20px/1 var(--font-sans); min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.app-minus .dg-icon { transform: rotate(45deg) scale(.9); }
.app-stickerbook { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 8px; }
.app-ach { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font: 500 14px/18px var(--font-sans); }
.app-ach.is-locked .dg-sticker { filter: grayscale(1); opacity: .28; }
.app-ach.is-locked > span:not(.dg-caption) { color: var(--ink-muted); }

/* book */
.app-book { position: relative; }
.app-book-hero { position: absolute; left: 0; right: 0; top: 0; height: 300px; border-radius: 0 0 28px 28px; }
.app-book-cover { position: relative; align-self: center; margin-top: 4px; }
.app-book-genre { position: absolute; right: -30px; bottom: 18px; }
.app-book-body { display: flex; flex-direction: column; gap: 18px; }
.app-tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.app-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.app-chapterbtn { display: block; width: 100%; padding: 0; background: none; border: 0; text-align: left; cursor: pointer; }
.app-bookfoot { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 8px; }
.app-confirm { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px; border-radius: var(--radius-md); background: var(--surface-200); text-align: center; }
.is-fav { color: var(--sticker-red); }
.is-fav .dg-icon { fill: currentColor; }

/* player */
.app-player { position: relative; }
.app-player-bg { position: absolute; left: 0; right: 0; top: 0; height: 520px; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.app-player-cover { position: relative; align-self: center; margin-top: 8px; }
.app-player-speedsticker { position: absolute; right: -26px; top: -14px; }
.app-player-body { position: relative; display: flex; flex-direction: column; gap: 18px; }
.app-scrub { display: flex; flex-direction: column; gap: 6px; }
.app-scrub-times { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.app-scrub input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; cursor: pointer; }
.app-scrub input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--sun), var(--periwinkle)) 0 0 / var(--pct, 0%) 100% no-repeat, var(--surface-200); }
.app-scrub input[type=range]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--surface-200); }
.app-scrub input[type=range]::-moz-range-progress { height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--sun), var(--periwinkle)); }
.app-scrub input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: var(--ink); border: 3px solid var(--surface-100); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.app-scrub input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 3px solid var(--surface-100); }
.app-scrub input[type=range]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
[data-theme="eink"] .app-scrub input[type=range]::-webkit-slider-runnable-track { background: linear-gradient(#000, #000) 0 0 / var(--pct, 0%) 100% no-repeat, #fff; box-shadow: inset 0 0 0 1.5px #000; }
.app-player .dg-controls { gap: 12px; }
.is-on { color: var(--sticker-blue); }
.app-upnext { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 0; border-radius: var(--radius-md); background: var(--surface-100); box-shadow: var(--shadow-card); text-align: left; cursor: pointer; }
.app-upnext > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.app-upnext-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-theme="eink"] .app-upnext { border: 2px solid #000; }
.app-sleep { display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* sheets */
.app-sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; }
.app-sheet-scrim { position: absolute; inset: 0; background: rgba(20,20,23,.36); }
.app-sheet { position: relative; max-width: 560px; width: 100%; margin: 0 auto; max-height: 88vh; max-height: 88dvh; box-sizing: border-box; display: flex; flex-direction: column; gap: 16px; padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0px)); border-radius: 24px 24px 0 0; background: var(--surface-100); color: var(--ink); overflow: auto; }
.app-sheet-handle { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); }
.app-sheet-head { display: flex; justify-content: space-between; align-items: center; }
.app-sheet-head h2 { margin: 0; font: 500 24px/30px var(--font-sans); }
.app-sheet-scroll { overflow: auto; margin-inline: -4px; padding-inline: 4px; }
[data-theme="eink"] .app-sheet { border: 2px solid #000; border-bottom: 0; }
@media (prefers-reduced-motion: no-preference) { .app-sheet { animation: sheet-in .22s ease-out; } }
@keyframes sheet-in { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
[data-theme="eink"] .app-sheet { animation: none; }

/* add sheet */
.app-drop { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 18px 22px; border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface-000); color: var(--ink); cursor: pointer; text-align: center; }
.app-drop-title { font: 500 19px/24px var(--font-sans); }
.app-drop .dg-btn { margin-top: 6px; pointer-events: none; }
.app-srclist { display: flex; flex-direction: column; }
.app-srcrow { display: flex; align-items: center; gap: 14px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.app-srcicon { width: 44px; height: 44px; flex: none; border-radius: 14px; background: var(--surface-200); display: grid; place-items: center; }
.app-srctext { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.app-srctitle { font: 500 16px/20px var(--font-sans); }

/* import */
.app-import-reading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 48px 12px; text-align: center; }
.app-import-head { display: flex; gap: 16px; align-items: flex-start; }
.app-import-found { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding-top: 4px; }
.app-import-sum { font: 500 20px/24px var(--font-sans); }
.app-form { display: flex; flex-direction: column; gap: 12px; }
.app-fieldrow { display: flex; gap: 12px; }
.app-field { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.app-field input { width: 100%; box-sizing: border-box; height: 48px; padding: 0 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-100); color: var(--ink); font: 400 16px var(--font-sans); }
.app-field input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.app-saving { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius-md); background: var(--surface-200); }
.app-import-cta { display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* mini player + tabs */
.app-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface-100); padding-bottom: env(safe-area-inset-bottom, 0px); border-top: 1px solid var(--line); }
.app-tabs .dg-tabbar { max-width: 560px; margin: 0 auto; border-top: 0; }
.app-mini { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 21; max-width: 536px; margin: 0 auto; }
.app-mini .dg-mini { max-width: none; }
.app-mini-open { position: absolute; inset: 0; z-index: 1; border: 0; background: transparent; border-radius: var(--radius-md); cursor: pointer; }
.app-mini .dg-ibtn { position: relative; z-index: 2; }

/* reader */
.app-reader { --r-bg: var(--surface-000); --r-ink: var(--ink); --r-muted: var(--ink-muted); position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--r-bg); color: var(--r-ink); }
.app-reader.is-sepia { --r-bg: #f5eddf; --r-ink: #3b2f22; --r-muted: #7a6a57; }
.app-reader.is-sepia .dg-caption, .app-reader.is-sepia .dg-label { color: var(--r-muted); }
.app-reader.is-sepia .dg-ibtn, .app-reader.is-sepia .app-iconlink { color: var(--r-ink); }
.app-reader-top { display: flex; align-items: center; gap: 4px; padding: calc(4px + env(safe-area-inset-top, 0px)) 8px 4px; border-bottom: 1px solid var(--line); }
.app-reader-booktitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.app-reader-tools { display: flex; }
.app-reader-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.app-reader-page { max-width: 38em; margin: 0 auto; padding: 28px 24px 40px; font-family: var(--font-serif); line-height: 1.62; }
.app-reader.is-sans .app-reader-page { font-family: var(--font-sans); }
.app-reader-chlabel { margin-bottom: 20px; font-family: var(--font-mono); }
.app-reader-html { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
.app-reader-html h1, .app-reader-html h2, .app-reader-html h3 { font-family: var(--font-serif); font-weight: 500; line-height: 1.25; letter-spacing: -.005em; text-wrap: balance; margin: 0 0 .8em; }
.app-reader-html h1 { font-size: 1.5em; } .app-reader-html h2 { font-size: 1.4em; } .app-reader-html h3 { font-size: 1.15em; }
.app-reader-html p { margin: 0 0 .9em; text-align: justify; }
.app-reader-html img { max-width: 100%; height: auto; display: block; margin: 1em auto; }
.app-reader-html blockquote { margin: 1em 0; padding-left: 1em; border-left: 2px solid var(--line-strong); color: var(--r-muted); }
.app-reader-html table { display: block; max-width: 100%; overflow-x: auto; }
.app-reader-html pre { white-space: pre-wrap; }
.app-reader-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }
.app-reader-foot { display: flex; align-items: center; gap: 14px; padding: 10px 20px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.app-reader-foot .dg-progress { flex: 1; }
.app-reader.is-sepia .app-reader-top, .app-reader.is-sepia .app-reader-foot, .app-reader.is-sepia .app-reader-nav { border-color: rgba(59,47,34,.15); }
[data-theme="eink"] .app-reader-top, [data-theme="eink"] .app-reader-foot { border-color: #000; border-width: 2px; }
.app-tocrow { display: flex; gap: 14px; width: 100%; padding: 14px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; font-size: 16px; }
.app-tocrow.is-current { font-weight: 500; }
@media (min-width: 700px) { .app-display { font-size: 48px; line-height: 52px; } }

/* book opening / closing animation */
.ba-layer { position: fixed; inset: 0; z-index: 100; }
.ba-stage { position: absolute; inset: 0; perspective: 1400px; perspective-origin: 50% 45%; }
.ba-book { position: absolute; transform-origin: 0 0; transform-style: preserve-3d; }
.ba-page { position: absolute; inset: 0; border-radius: 3px 8px 8px 3px; overflow: hidden; box-shadow: 0 10px 30px rgba(20,20,23,.25); }
.ba-page::after { content: ""; position: absolute; top: 2%; bottom: 2%; right: 0; width: 5px; background: repeating-linear-gradient(90deg, rgba(0,0,0,.06) 0 1px, transparent 1px 2px); border-radius: 0 6px 6px 0; }
.ba-lines { position: absolute; left: 14%; right: 12%; top: 13%; display: flex; flex-direction: column; gap: 5.5%; height: 70%; }
.ba-lines i { display: block; height: 3px; border-radius: 2px; }
.ba-cover { position: absolute; inset: 0; transform-origin: 0 50%; transform-style: preserve-3d; }
.ba-front, .ba-back { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; border-radius: 3px 8px 8px 3px; overflow: hidden; }
.ba-back { transform: rotateY(180deg); box-shadow: inset -16px 0 20px -14px rgba(0,0,0,.25); }
.ba-front .dg-cover { position: absolute; inset: 0; aspect-ratio: auto; border-radius: inherit; }
.ba-front::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 7%; background: linear-gradient(90deg, rgba(0,0,0,.18), rgba(255,255,255,.08) 60%, transparent); }
.ba-leaf { position: absolute; top: 1.2%; bottom: 1.2%; left: 0; right: 1.2%; transform-origin: 0 50%; transform-style: preserve-3d; }
.ba-leaf-face { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; border-radius: 2px 7px 7px 2px; overflow: hidden; box-shadow: inset 10px 0 14px -12px rgba(0,0,0,.25), 1px 0 0 rgba(0,0,0,.06); }
.ba-leaf-back { transform: rotateY(180deg); box-shadow: inset -10px 0 14px -12px rgba(0,0,0,.25); }
.ba-leaf-face .ba-lines b { display: block; height: 34%; border-radius: 3px; margin-bottom: 4%; flex: none; }

/* update banner */
.app-update { position: fixed; left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 40; max-width: 536px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 12px; border-radius: var(--radius-md); background: var(--surface-100); color: var(--ink); box-shadow: var(--shadow-card); border: 1px solid var(--line); }
.app-update.is-raised { bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
.app-update.is-low { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.app-update-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.app-update-title { font: 500 15px/19px var(--font-sans); }
[data-theme="eink"] .app-update { border: 2px solid #000; }
@media (prefers-reduced-motion: no-preference) { .app-update { animation: sheet-in .25s ease-out; } }
.app-versionrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.app-versionrow > div > span { font: 500 16px/20px var(--font-sans); }

/* ============ 1.5.6 — matched to the design canvas ============ */
.app-pad .app-section { padding-inline: 0; }
.app-home { gap: 20px; }
.app-hero { min-height: 256px; padding-top: calc(56px + env(safe-area-inset-top, 0px)); }
.app-hero-sticker { right: 22px; bottom: 22px; }
.app-continue-meta .app-small { font-size: 13px; }
.app-row { align-items: flex-start; scroll-padding-inline: 16px; gap: 23px; }
.app-row-tight { gap: 14px; }
.app-tile { align-self: flex-start; display: block; }
.app-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 12px; }
.app-grid .app-tile, .app-grid .dg-book { width: 100% !important; }
.app-grid .dg-cover { width: 100% !important; }
.app-titletools { display: flex; gap: 8px; align-items: center; }
.app-addbtn { width: 44px; height: 44px; }
.app-library { gap: 16px; }
.app-library .app-shelf { margin-top: 8px; }
.app-sortlist { display: flex; flex-direction: column; }
.app-sortrow { display: flex; justify-content: space-between; align-items: center; min-height: 52px; padding: 0 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font: 400 16px/20px var(--font-sans); cursor: pointer; }
.app-sortrow.is-on { font-weight: 500; }
.app-sortrow:focus-visible, .app-calm:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* search */
.app-search { gap: 18px; }
.app-searchbox { position: relative; }
.app-searchbox .dg-search { padding-right: 48px; }
.app-searchclear { position: absolute; right: 6px; top: 6px; }
.dg-search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.app-list { gap: 0; }
.app-listrow { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.app-listrow > .dg-icon { color: var(--ink-muted); flex: none; }
.app-result .dg-cover { font-size: 8px; }
.app-result-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.app-result-title { font: 500 16px/21px var(--font-sans); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.app-result-tags { display: flex; gap: 6px; margin-top: 3px; }
.app-chresult-icon { width: 44px; height: 44px; flex: none; border-radius: 14px; background: var(--surface-200); display: grid; place-items: center; }
.app-snippet { flex-direction: column; align-items: stretch; gap: 6px; padding: 14px 0; }
.app-snippet-text { font: 400 15px/23px var(--font-serif); color: var(--ink); }
mark, .app-found { background: color-mix(in srgb, var(--sun) 70%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.app-found { background: var(--sun); color: #1d1c1a; }
[data-theme="dark"] mark { background: rgba(246,207,94,.35); }
[data-theme="eink"] mark, [data-theme="eink"] .app-found { background: none; text-decoration: underline; text-decoration-thickness: 2px; font-weight: 600; }
.app-genrecard { color: var(--ink); }

/* you */
.app-you { gap: 22px; }
.app-yourstats { flex-wrap: nowrap; }
.app-stickerbook { gap: 20px 12px; }
.app-ach { gap: 8px; }
.app-ach-value { font: 500 17px/20px var(--font-sans); margin-top: 4px; }
.app-goal > span { font: 500 16px/20px var(--font-sans); }

/* book */
.app-book { gap: 0; }
.app-book-hero { height: 330px; }
.app-topbar-tools { display: flex; }
.app-book .app-topbar { color: #1d1c1a; }
[data-theme="dark"] .app-book .app-topbar { color: var(--ink); }
.app-book-cover { margin-top: 24px; }
.app-book-sticker { position: absolute; right: -47px; top: 22px; }
.app-book-sticker.is-genre { right: -30px; top: 34px; }
.app-book-body { gap: 14px; padding-top: 16px; }
.app-book-titles { display: flex; flex-direction: column; gap: 4px; }
.app-book-titles .app-muted { font-size: 14px; }
.app-book-body .app-actions { flex-wrap: nowrap; }
.app-blurb p { margin: 4px 0 0; font: 400 15px/23px var(--font-sans); }
.app-blurb .app-textlink { padding-bottom: 0; }
.app-chhead { padding: 10px 0 4px; align-items: baseline; }
.app-book .app-confirm { margin-top: 12px; }

/* player */
.app-player { gap: 0; min-height: 100vh; min-height: 100dvh; }
.app-player-cover { margin-top: 28px; }
.app-player-speedsticker { right: -35px; top: -20px; }
.app-player-body { gap: 18px; margin-top: 26px; }
.app-player-body .app-muted { font-size: 14px; margin-top: 4px; }
.app-scrub { gap: 2px; }
.app-scrub input[type=range] { height: 22px; }
.app-scrub input[type=range]::-webkit-slider-thumb { width: 14px; height: 14px; margin-top: -4px; border-width: 2px; }
.app-controls { justify-content: space-between; width: 100%; }
.app-upnext { margin: 22px 16px 0; padding: 0; cursor: default; }
.app-upnext-next { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 0 12px 16px; border: 0; background: none; text-align: left; color: var(--ink); cursor: pointer; border-radius: var(--radius-md); }
.app-upnext-all { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border: 0; background: none; color: var(--ink); cursor: pointer; border-radius: var(--radius-md); }
.app-upnext-all .dg-caption { color: var(--ink); }
.app-upnext-next:focus-visible, .app-upnext-all:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* reader */
.app-reader-top { justify-content: space-between; min-height: 52px; }
.app-reader-head { display: flex; justify-content: space-between; margin-bottom: 28px; font-family: var(--font-mono); }
.app-reader-page { padding: 28px 32px 40px; line-height: 1.63; }
.app-reader-html h1, .app-reader-html h2 { font-size: 1.47em; }
.app-reader-html h1 + p::first-letter, .app-reader-html h2 + p::first-letter, .app-reader-html h3 + p::first-letter { float: left; font-size: 3.1em; line-height: .9; padding: 4px 8px 0 0; font-weight: 500; }
.app-reader-html h1 + p, .app-reader-html h2 + p, .app-reader-html h3 + p { text-align: left; }
.app-reader-html p + p { text-indent: 1.4em; margin-bottom: 0; }
.app-reader-html p { margin-bottom: 0; }
.app-reader-foot { border-top: 0; padding: 8px 32px; }
.app-reader-foot .dg-progress { max-width: 42%; }
.app-reader-actions { display: flex; align-items: center; gap: 10px; padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
.app-reader .dg-btn-primary { background: var(--r-ink); color: var(--r-bg); }
.app-reader .dg-ibtn-outline { background: transparent; color: var(--r-ink); }
.is-marked { color: var(--sticker-orange); }
.is-marked .dg-icon path { fill: currentColor; }
.app-markrow span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-selfstart { align-self: flex-start; }
.app-sizerow { display: flex; align-items: center; gap: 16px; }
.app-calm { display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 6px; padding: 14px; border: 0; border-radius: var(--radius-md); background: var(--surface-200); color: var(--ink); text-align: left; cursor: pointer; }
.app-calm-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }

/* sheets */
.app-sheet.is-big { min-height: calc(100vh - 64px); min-height: calc(100dvh - 64px); gap: 18px; }
.app-sheet-head h2 { font-size: 19px; line-height: 24px; }
.app-sheet.is-big .app-sheet-head h2 { font-size: 26px; line-height: 32px; }
.dg-search input:focus-visible { outline: none; }
.app-reader .app-sheet-scrim { background: rgba(20,20,23,.16); }
.app-drop { padding: 36px 20px 24px; }
.app-drop.is-over { border-color: var(--sticker-blue); background: var(--surface-200); }
.app-srcrow.is-soon { cursor: default; }
.app-srcrow.is-soon .app-srctext, .app-srcrow.is-soon .app-srcicon { opacity: .55; }
.app-srcrow { color: var(--ink); }
.app-block { display: block; }
.app-srclist .dg-label { padding-bottom: 4px; }

/* ============ 1.5.6 — free libraries + links ============ */
.app-freecard { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: var(--radius-md); background: var(--surface-200); }
.app-freecard p { margin-top: 2px; }
.app-free-head { display: flex; gap: 16px; align-items: flex-start; }
.app-free-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding-top: 2px; }
.app-free-title { font: 500 20px/24px var(--font-sans); text-wrap: balance; }
.app-result-tags .dg-tag-neutral { white-space: nowrap; }
.app-linkhelp { display: flex; flex-direction: column; gap: 8px; }
.app-linkhelp ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; line-height: 20px; }
.app-dlbar { position: fixed; left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 39; max-width: 536px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 10px; border-radius: var(--radius-md); background: var(--surface-100); color: var(--ink); box-shadow: var(--shadow-card); border: 1px solid var(--line); }
.app-dlbar.is-raised { bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
.app-dlbar.is-low { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.app-dlbar-open { position: absolute; inset: 0; border: 0; background: transparent; border-radius: inherit; cursor: pointer; }
.app-dlbar-x { position: relative; z-index: 1; }
.app-dlbar .app-update-text { gap: 6px; }
.app-dlbar .app-update-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-theme="eink"] .app-dlbar { border: 2px solid #000; }

.app-blurb p { white-space: pre-line; }

/* ============ 1.5.6 — storage check ============ */
.app-storage { gap: 12px; }
.app-storage .dg-btn { align-self: flex-start; }
.app-warn { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--sticker-red) 14%, var(--surface-100)); color: var(--ink); }
.app-warn p { margin: 0; }
.app-checklist { display: flex; flex-direction: column; padding: 4px 14px 10px; border-radius: var(--radius-md); background: var(--surface-100); box-shadow: var(--shadow-card); }
.app-checkrow { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.app-checkrow .dg-caption { text-align: right; text-transform: none; letter-spacing: 0; font-size: 12px; overflow-wrap: anywhere; }
.app-checklist > p { margin: 10px 0 0; }
.is-ok { color: var(--positive) !important; } .is-bad { color: var(--negative) !important; }
.app-storebar { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px; border: 0; background: var(--sticker-red); color: #fff; font: 500 14px/18px var(--font-sans); cursor: pointer; }
.app-storebar u { text-underline-offset: 3px; }

/* 1.5.6 — WebKit (iPhone) needs every face on its own 3D layer, or back faces show through */
.ba-stage, .ba-book, .ba-cover, .ba-leaf { -webkit-transform-style: preserve-3d; transform-style: preserve-3d; }
.ba-front, .ba-back, .ba-leaf-face { -webkit-backface-visibility: hidden; backface-visibility: hidden; will-change: transform; }
.ba-front, .ba-leaf-face:not(.ba-leaf-back) { -webkit-transform: rotateY(0deg) translateZ(.01px); transform: rotateY(0deg) translateZ(.01px); }
.ba-back, .ba-leaf-back { -webkit-transform: rotateY(180deg) translateZ(.01px); transform: rotateY(180deg) translateZ(.01px); }
.ba-page { -webkit-transform: translateZ(-1px); transform: translateZ(-1px); }

/* 1.5.6 — custom covers */
.app-minicover { width: 26px; height: 39px; padding: 0; border-radius: 4px; box-shadow: none; }
.app-coverpick { position: relative; flex: none; padding: 0; border: 0; background: none; cursor: pointer; border-radius: var(--radius-sm); }
.app-coverpick-tag { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--ink); color: var(--ink-inverse); font: 500 12px/1 var(--font-sans); white-space: nowrap; box-shadow: var(--shadow-card); }
.app-coverpick:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* 1.5.6 — tab bar reaches the bottom edge on iPhone home-screen apps */
.app-tabs::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 200px; background: inherit; }
html { background: var(--surface-000); }
