@font-face { font-family: Novens; src: url('roboto-400.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Novens; src: url('roboto-500.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: Novens; src: url('roboto-700.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: NovensEditorial; src: url('playfair-400.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: NovensEditorial; src: url('playfair-700.ttf') format('truetype'); font-weight: 700; font-display: swap; }
:root { color-scheme: light; --bg: #f7f6f2; --surface: #fff; --text: #202624; --muted: #616b66; --primary: #245b57; --on-primary: #fff; --soft: #e8eee9; --line: #cfd7d1; --shadow: 0 16px 50px rgb(22 56 47 / .12); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { color-scheme: dark; --bg: #141a18; --surface: #1e2723; --text: #f1f3ef; --muted: #b6c2bb; --primary: #a1d2bf; --on-primary: #16382f; --soft: #26322d; --line: #43514a; --shadow: 0 16px 50px rgb(0 0 0 / .25); } }
:root[data-theme='dark'] { color-scheme: dark; --bg: #141a18; --surface: #1e2723; --text: #f1f3ef; --muted: #b6c2bb; --primary: #a1d2bf; --on-primary: #16382f; --soft: #26322d; --line: #43514a; --shadow: 0 16px 50px rgb(0 0 0 / .25); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Novens, system-ui, sans-serif; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
button, input, select, a { touch-action: manipulation; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
button, select, input { border-radius: 8px; }
a { color: var(--primary); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: -80px; left: 20px; z-index: 20; padding: 12px; background: var(--surface); }
.skip-link:focus { top: 12px; }
.app-header { max-width: 1120px; margin: auto; display: flex; align-items: center; gap: 16px; min-height: 72px; padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); }
.brand { display: flex; align-items: center; }
.brand img { object-fit: contain; width: 126px; height: 40px; }
.header-caption { font-size: 13px; color: var(--muted); letter-spacing: .035em; }
.app-header > button { margin-left: auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .brand img { filter: invert(1); } }
:root[data-theme='dark'] .brand img { filter: invert(1); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; height: 48px; border: 0; background: transparent; font-size: 24px; padding: 8px; color: var(--primary); flex-shrink: 0; }
.app-main { max-width: 1120px; margin: auto; padding: 12px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left)); min-height: 65vh; }
.library-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 24px 0 12px; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: .16em; margin: 0 0 8px; color: var(--muted); }
h1 { font: 400 clamp(30px, 4vw, 42px)/1.15 NovensEditorial, Georgia, serif; margin: 0; }
h2 { font-size: 20px; line-height: 1.35; margin: 0 0 18px; }
.library-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.format-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.format-tabs button { min-height: 44px; display: inline-flex; gap: 6px; align-items: center; justify-content: center; padding: 8px 12px; background: transparent; border: 1px solid var(--line); font-size: 14px; font-weight: 500; }
.format-tabs .selected { background: var(--soft); color: var(--primary); border-color: var(--primary); }
.catalog-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tool-button, .order-control select { min-height: 44px; background: transparent; border: 1px solid var(--line); padding: 8px 10px; font-size: 13px; }
.tool-button { display: inline-flex; gap: 8px; align-items: center; }
.order-control { display: flex; gap: 4px; align-items: center; min-width: 0; max-width: 100%; padding-left: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.order-control select { max-width: 100%; min-width: 0; border: 0; padding-left: 2px; }
option { background: var(--surface); color: var(--text); }
.search-form { display: flex; gap: 8px; padding: 16px 0 0; }
.search-form input { min-width: 0; flex: 1; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); }
.primary-button, .secondary-button { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 10px 20px; font-weight: 500; text-decoration: none; border-radius: 8px; line-height: 1.4; }
.primary-button { color: var(--on-primary); background: var(--primary); border: 1px solid var(--primary); }
.secondary-button { color: var(--primary); background: transparent; border: 1px solid var(--line); }
.text-button, .back-button { min-height: 44px; padding: 8px 0; color: var(--primary); background: transparent; border: 0; font-size: 14px; }
.active-filters { display: flex; gap: 16px; align-items: center; justify-content: space-between; color: var(--primary); font-size: 13px; padding-top: 8px; }
.resume-section { margin: 20px 0; }
.resume-section h2 { font: 700 21px/1.35 NovensEditorial, Georgia, serif; margin-bottom: 10px; }
.resume-card { display: flex; align-items: center; gap: 10px; background: var(--soft); border: 0; border-radius: 10px; padding: 10px; text-align: left; width: 100%; }
.resume-card .cover { width: 34px; height: 48px; border-radius: 3px; flex-shrink: 0; }
.resume-card .resume-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.resume-card strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume-card small { font-size: 12px; color: var(--muted); }
.resume-card .resume-play { color: var(--primary); font-weight: 700; font-size: 13px; flex-shrink: 0; }
.catalog-status { color: var(--muted); font-size: 13px; text-align: center; }
.catalog-status:empty { display: none; }
.book-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.book-card { min-width: 0; background: var(--surface); border-radius: 12px; }
.book-open { display: flex; align-items: flex-start; gap: 16px; padding: 14px; text-align: left; background: transparent; color: inherit; border: 0; width: 100%; height: 100%; border-radius: inherit; }
.cover { display: block; width: 100%; height: auto; aspect-ratio: 2/3; object-fit: contain; background: var(--soft); border-radius: 5px; box-shadow: 0 5px 14px rgb(0 0 0 / .08); }
.cover-placeholder { display: flex; align-items: center; justify-content: center; padding: 18px; background: var(--primary); color: var(--on-primary); font: 400 44px NovensEditorial, Georgia, serif; }
.book-card h2 { font: 700 18px/1.35 NovensEditorial, Georgia, serif; margin: 0 0 5px; overflow-wrap: anywhere; }
.book-card .authors { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.book-formats { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 12px; color: var(--muted); padding-top: 10px; }
.book-formats span { display: inline-flex; align-items: center; gap: 5px; }
.book-formats svg { width: 14px; height: 14px; }
.load-more-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 24px; }
.empty-state { padding: 42px 16px; text-align: center; grid-column: 1/-1; border: 1px dashed var(--line); border-radius: 8px; width: 100%; }
.empty-state h2 { margin-bottom: 8px; font-family: NovensEditorial, Georgia, serif; font-weight: 400; }
.empty-state p { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.app-footer { max-width: 1088px; margin: 10px 16px 0; display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; border-top: 1px solid var(--line); padding: 24px 0 calc(24px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; }
.app-footer > span { letter-spacing: .13em; }
.app-footer a { text-decoration: none; }
body.has-player { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.mini-player { position: fixed; z-index: 5; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 1120px); display: flex; align-items: center; background: var(--surface); box-shadow: 0 -4px 22px rgb(0 0 0 / .08); border: 1px solid var(--line); border-bottom: 0; padding: 10px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.mini-copy { flex: 1; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; text-align: left; min-width: 0; padding: 0; }
.mini-copy > span:last-child { min-width: 0; }
.mini-copy strong, .mini-copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-copy strong { font-weight: 500; font-size: 13px; }
.mini-copy small { color: var(--muted); font-size: 11px; }
.mini-cover { width: 36px; flex-shrink: 0; }
.mini-cover .cover { height: 52px; font-size: 20px; padding: 3px; }
.mini-player progress { position: absolute; top: -1px; left: 0; width: 100%; height: 3px; accent-color: var(--primary); border: 0; }
.mini-player progress::-webkit-progress-bar { background: var(--line); }
.mini-player progress::-webkit-progress-value { background: var(--primary); }
.mini-player progress::-moz-progress-bar { background: var(--primary); }
.play-button { font-size: 19px; }
dialog { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); max-height: calc(100dvh - 32px); overflow-y: auto; }
dialog::backdrop { background: rgb(14 27 22 / .55); }
.app-dialog { width: min(460px, calc(100% - 32px)); padding: 24px; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.dialog-header h2 { margin: 0; font-size: 20px; font-weight: 500; }
.dialog-header .icon-button { margin: -8px -8px -8px 0; }
.app-dialog label { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; font-size: 14px; }
.app-dialog select { width: 100%; min-height: 48px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--line); }
.dialog-actions { display: flex; gap: 10px; margin-top: 24px; }
.dialog-actions > button { flex: 1; }
.profile-name { font-size: 20px; margin-bottom: 0; }
.muted { color: var(--muted); font-size: 14px; }
.profile-link { display: block; padding: 12px 0; border: 0; background: transparent; color: var(--primary); font-size: 14px; min-height: 44px; text-align: left; }
.back-button { margin-bottom: 18px; }
.detail-intro { display: flex; gap: 32px; align-items: flex-start; }
.detail-cover { width: 180px; flex-shrink: 0; }
.detail-copy { flex: 1; min-width: 0; }
.detail-copy h1 { font-size: clamp(24px, 3vw, 34px); line-height: 1.25; margin: 8px 0 10px; }
.detail-copy .authors { color: var(--muted); font-size: 15px; margin: 0 0 12px; }
.detail-info { color: var(--muted); font-size: 12px; margin-bottom: 18px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.detail-actions > * { gap: 8px; }
.synopsis { margin: 30px 0; border-top: 1px solid var(--line); padding-top: 24px; }
.synopsis h2, .chapters-heading { font-size: 18px; }
.synopsis-text { font-size: 15px; line-height: 1.7; white-space: pre-line; color: var(--muted); margin-bottom: 0; }
.synopsis-text.collapsed { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.chapter-row { display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px 8px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; text-align: left; background: transparent; }
.chapter-number { font-size: 12px; color: var(--muted); width: 26px; flex-shrink: 0; }
.chapter-title { flex: 1; min-width: 0; font-size: 14px; }
.chapter-title small { display: block; color: var(--muted); font-size: 11px; padding-top: 4px; }
.chapter-row.active { background: var(--soft); color: var(--primary); }
.chapter-play { color: var(--primary); font-size: 15px; }
.access-notice { padding: 16px; background: var(--soft); border-radius: 8px; font-size: 14px; }
.player-dialog { width: min(440px, calc(100% - 24px)); padding: 24px 28px; text-align: center; background: var(--bg); }
.player-dialog .dialog-header { text-align: left; }
.player-cover { width: min(210px, 58vw); margin: 12px auto 24px; }
.player-cover .cover { max-height: 32dvh; aspect-ratio: 2/3; }
.player-dialog h2 { margin: 0 0 4px; font-size: 20px; }
.player-dialog #player-author { margin: 0 0 16px; }
.player-chapter { font-size: 13px; color: var(--primary); }
#player-seek { width: 100%; height: 28px; margin: 8px 0 0; accent-color: var(--primary); cursor: pointer; }
.player-times { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.player-controls { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin: 20px 0; }
.big-play { width: 64px; height: 64px; border-radius: 50%; background: var(--primary); color: var(--on-primary); border: 0; font-size: 24px; flex-shrink: 0; }
.skip-button { font-size: 14px; font-weight: 700; }
.speed-control { display: flex; justify-content: center; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }
.speed-control select { min-height: 44px; padding: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
#player-status { min-height: 20px; font-size: 12px; margin-bottom: 0; }
.toast { position: fixed; bottom: calc(100px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); max-width: calc(100% - 24px); width: max-content; z-index: 10; font-size: 13px; }
/* The catalog follows Android's cover + copy cards; desktop gains columns. */
.library-controls { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.library-heading h1 { font: 700 23px/1.35 NovensEditorial, Georgia, serif; }
.profile-button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; max-width: 50%; padding: 8px; background: transparent; color: var(--primary); border: 0; font-size: 14px; font-weight: 500; }
.profile-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-copy { flex: 1; min-width: 0; }
.book-open > .cover, .catalog-book > .cover-link { width: 76px; height: 114px; flex-shrink: 0; }
.book-open > .cover { box-shadow: none; border-radius: 4px; }
.book-featured { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-size: 11px; font-weight: 700; margin-bottom: 5px; }
.book-featured svg { width: 13px; height: 13px; }
.book-category { color: var(--primary); font-size: 12px; margin: 6px 0 0; }
.tool-button.selected { color: var(--primary); border-color: var(--primary); background: var(--soft); }
::selection { background: var(--primary); color: var(--on-primary); }
input { caret-color: var(--primary); }
a { text-underline-offset: 3px; }
.player-times { font-variant-numeric: tabular-nums; }
@media (hover: hover) {
    .book-open:hover { background: var(--soft); }
    .book-open:hover h2 { color: var(--primary); }
    .tool-button:hover, .format-tabs button:hover, .profile-button:hover { background: var(--soft); }
}
@media (min-width: 720px) {
    .app-header { padding-left: 28px; padding-right: 28px; min-height: 80px; }
    .app-main { padding: 16px 28px 40px; }
    .library-controls { flex-direction: row; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
    .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .book-open { padding: 18px; }
    .book-open > .cover, .catalog-book > .cover-link { width: 90px; height: 135px; }
    .book-card h2 { font-size: 20px; }
    .library-heading { margin-top: 28px; }
    .app-footer { margin-left: 28px; margin-right: 28px; }
}
@media (min-width: 1144px) { .app-footer { margin-left: auto; margin-right: auto; } }
@media (max-width: 650px) {
    .order-control > span { display: none; }
    .format-tabs svg { width: 16px; height: 16px; }
    .tool-button svg { width: 16px; height: 16px; }
    .detail-intro { gap: 18px; }
    .detail-cover { width: 110px; }
    .detail-copy h1 { font-size: 23px; }
    .detail-copy .authors { font-size: 13px; }
    .detail-actions { margin-top: 18px; }
    .detail-actions > * { padding: 10px 14px; font-size: 13px; }
    .detail-info { font-size: 12px; margin-bottom: 10px; }
    .player-dialog { padding: 20px; }
}
@media (max-width: 360px) {
    .tool-button { padding: 8px; gap: 4px; }
    .order-control { padding-left: 6px; }
    .order-control > span { display: none; }
    .order-control select { padding-right: 4px; }
    .book-open { gap: 12px; padding: 12px; }
    .detail-cover { width: 88px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

.brand { flex-direction: column; align-items: flex-start; gap: 2px; flex-shrink: 0; }
.brand-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
#completed-view > .muted { max-width: 65ch; margin-bottom: 24px; }
#completed-status { color: var(--muted); }

/* Direct, keyboard-accessible speed choices, matching the Android player. */
.speed-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; border: 0; padding: 12px 0 0; margin: 0; min-width: 0; }
.speed-options legend { width: 100%; padding: 0 0 4px; text-align: center; font-size: 14px; color: var(--muted, #616B66); }
.speed-options label { position: relative; cursor: pointer; }
.speed-options input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.speed-options span { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 6px; border-radius: 4px; color: var(--muted, #616B66); font-size: 14px; }
.speed-options input:checked + span { font-weight: 700; color: var(--primary, #245B57); background: var(--soft, #E8F5F0); }
.speed-options input:focus-visible + span { outline: 2px solid var(--primary, #245B57); outline-offset: 2px; }
[data-speed-control][hidden] { display: none; }
@media (max-width: 480px) {
    .speed-options { display: grid; grid-template-columns: repeat(3, minmax(44px, 64px)); }
    .player-dialog { width: calc(100vw - 24px); max-width: calc(100vw - 24px); padding: 20px 12px; }
    .player-controls { gap: 0; }
    .player-controls .icon-button { min-width: 44px; width: 44px; padding: 6px; }
    .player-cover .cover { max-height: 28dvh; }
}
@media (max-width: 360px) {
    .player-controls .big-play { width: 56px; height: 56px; }
}

/* Account navigation: anchored menu; appearance opens only on selection. */
.app-header > .user-menu, .app-header > .account-login { margin-left: auto; }
.account-login { text-decoration: none; }
.user-menu { position: relative; flex-shrink: 0; max-width: 50%; }
.user-menu > summary { max-width: 100%; list-style: none; cursor: pointer; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 8px; }
.user-menu-panel { position: absolute; z-index: 15; inset-inline-end: 0; top: calc(100% + 6px); width: 224px; max-width: calc(100vw - 32px); padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.user-menu-panel a, .user-menu-panel button { display: flex; align-items: center; width: 100%; min-height: 48px; padding: 10px 14px; border: 0; background: transparent; color: var(--text); font-size: 14px; text-align: start; text-decoration: none; border-radius: 7px; }
.user-menu-panel a:hover, .user-menu-panel button:hover, .user-menu-panel a:focus-visible, .user-menu-panel button:focus-visible { background: var(--soft); }
.user-menu-panel form { margin: 0; }
.user-menu-panel [role="status"]:empty { display: none; }
.user-menu-panel [role="status"] { margin: 8px 14px; }
.app-footer nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 20px; }
.app-footer .text-button { font-size: inherit; font-weight: inherit; }
@media (max-width: 480px) { .app-footer nav { justify-content: flex-start; } }
