/* A book's home: book information, reading activity, journal, then management. */
:root #bookDialog{
  --book-field:#fff;--book-panel:#f1f4fa;--book-border:#e3e8f1;
  --book-action:#415bd9;--book-action-hover:#3047b5;--book-action-text:#fff;
  --book-ink:#202d46;--book-muted:#68758b;
  width:min(940px,calc(100vw - 48px));max-height:min(940px,92dvh);
  padding:0;border-radius:26px;border:1px solid #ffffff55;background:linear-gradient(145deg,#f0f2fc,#f8f7fd 48%,#edf7fb)!important;
  color:var(--book-ink);box-shadow:0 36px 120px #0c163a55;
}
:root #bookDialog::backdrop{background:#111c3d94;backdrop-filter:blur(10px)}
:root #bookDialog #bookForm{padding:0 28px 18px;margin:0}
:root #bookDialog .dialog-header{position:sticky;top:0;z-index:10;display:flex;align-items:center;justify-content:space-between;height:50px;min-height:50px;margin:0 -28px;padding:10px 24px 8px;background:#182447;color:#b9c9f5}
:root #bookDialog .dialog-header .eyebrow{font-size:9px;letter-spacing:1.7px;color:#b9c9f5}
:root #bookDialog .dialog-header .icon-button{display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:#ffffff10;color:#e2eaff;font-size:16px}
:root #bookDialog .dialog-header .icon-button:hover{background:#ffffff24}
:root #bookDialog .book-detail-top{
  display:flex;align-items:center;gap:28px;margin:0 -28px 0;padding:12px 32px 30px;
  border:0;border-radius:0;background:radial-gradient(ellipse at 95% 0%,#5e69ac55,transparent 60%),linear-gradient(120deg,#182447,#233968);
  position:relative;overflow:hidden;min-width:0;
}
:root #bookDialog #detailCover{width:120px;height:166px;border-radius:5px;box-shadow:6px 12px 26px #060f2a65,0 0 0 1px #ffffff20;flex-shrink:0;transform:rotate(-3deg)}
:root #bookDialog .book-hero-copy{min-width:0;flex:1}
:root #bookDialog .book-hero-facts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:18px 0 0}
:root #bookDialog .book-hero-facts dt{font-size:9px;color:#b9c9e5;margin-bottom:5px}
:root #bookDialog .book-hero-facts dd{font-size:11px;color:#fff;margin:0;line-height:1.5}
:root #bookDialog .book-hero-actions{display:flex;flex-wrap:wrap;gap:8px;margin:0 -28px;padding:0 28px 20px;background:linear-gradient(120deg,#182447,#233968)}
:root #bookDialog .book-hero-actions button{display:inline-flex;align-items:center;justify-content:center;gap:7px;flex:1;min-width:105px;padding:10px 8px;min-height:39px;border:1px solid #ffffff35;border-radius:9px;background:#ffffff0b;color:#fff;font-size:10px}
:root #bookDialog .book-hero-actions button:first-child{background:#8b9bf0;color:#101b41;border-color:transparent;font-weight:600}
:root #bookDialog .book-hero-actions button:disabled{opacity:.5;cursor:default}
:root #bookDialog .book-hero-actions button:hover:enabled{background:#ffffff26}
:root #bookDialog .book-hero-actions svg{width:14px;height:14px;flex-shrink:0}
:root #bookDialog .book-quick-message:empty{display:none}
:root #bookDialog .book-quick-message{margin:0;padding:12px 0;font-size:12px;line-height:1.6;color:var(--book-action)}
:root #bookDialog .book-hero-label{display:block;font-size:9px;letter-spacing:2px;color:#bac7ef;margin-bottom:12px}
:root #bookDialog .book-detail-top h2{font-size:clamp(25px,3vw,36px);font-weight:650;letter-spacing:-1px;line-height:1.15;margin-bottom:8px;overflow-wrap:anywhere}
:root #bookDialog .book-detail-top p{font-size:14px;color:#cfdaee;margin:0}
:root #bookDialog #detailRating{font-size:18px;letter-spacing:2px;margin:12px 0 10px;color:#ffda81}
:root #bookDialog #detailRating[data-unrated="true"]{color:#becce7;font-size:11px;letter-spacing:0}
:root #bookDialog #detailRating{display:flex;align-items:center;flex-wrap:wrap;gap:1px;letter-spacing:0;min-height:34px}
:root #bookDialog .book-rating-star{display:grid;place-items:center;width:30px;height:34px;padding:0;color:#ffda81;background:transparent;border:0;border-radius:5px;flex-shrink:0}
:root #bookDialog .book-rating-star:hover{background:#ffffff18}
:root #bookDialog .book-rating-star:focus-visible{outline:2px solid #ffda81;outline-offset:2px}
:root #bookDialog .book-rating-glyph{position:relative;display:block;width:24px;height:24px}
:root #bookDialog .book-rating-glyph>svg{display:block;width:24px;height:24px;fill:none;stroke:#becce7;stroke-width:1.4}
:root #bookDialog .book-rating-fill{position:absolute;left:0;top:0;height:24px;overflow:hidden;pointer-events:none}
:root #bookDialog .book-rating-fill svg{display:block;width:24px;height:24px;max-width:none;fill:#ffda81;stroke:#ffda81;stroke-width:1.4}
:root #bookDialog .book-rating-value{font-size:10px;line-height:1.5;color:#d4def2;margin-left:8px;letter-spacing:0}
:root #bookDialog .book-save-information{min-width:0}
:root #bookDialog #bookCloudSaveStatus{font-size:10px;line-height:1.5;color:var(--book-muted);margin:4px 0 0}
:root #bookDialog #bookCloudSaveStatus[data-state="saved"]{color:var(--book-action)}
:root #bookDialog #bookCloudSaveStatus:is([data-state="error"],[data-state="conflict"],[data-state="offline"]){color:#b54a4a}
:root #bookDialog .favorite-toggle{display:inline-flex;align-items:center;gap:7px;border-radius:20px;padding:6px 10px;min-height:30px;background:#ffffff09;border-color:#ffffff25}
:root #bookDialog .favorite-toggle svg{width:15px;height:15px}
:root #bookDialog .favorite-toggle[aria-pressed="true"]{background:#e8789c22;border-color:#f5a1bb66}
:root #bookDialog .book-detail-tabs{gap:12px;margin:0 -28px 22px;padding:0 28px;border-radius:0;background:var(--book-field);border-bottom:1px solid var(--book-border);box-shadow:none;top:50px}
:root #bookDialog .book-detail-tabs button{flex:0 1 auto;padding:17px 13px;border-radius:0;border-bottom:2px solid transparent;font-size:12px;font-weight:600;color:var(--book-muted);min-height:50px}
:root #bookDialog .book-detail-tabs button[aria-selected="true"]{color:var(--book-action);background:transparent;border-bottom-color:var(--book-action);box-shadow:none}
:root #bookDialog .book-detail-tabs button:hover{color:var(--book-action)}
:root #bookDialog [role="tabpanel"]{min-width:0}
:root #bookDialog .book-meta-chips{gap:6px;margin-bottom:18px}
:root #bookDialog .book-meta-chips span{padding:5px 10px;background:#eaeef9;color:#52618a;font-size:10px;border-radius:6px}
:root #bookDialog .book-meta-chips span:first-child{color:#276b64;background:#e6f4ef}
:root #bookDialog .book-overview-grid{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);gap:16px;align-items:start}
:root #bookDialog .book-panel-card{border:1px solid var(--book-border);border-radius:16px;padding:22px;margin:0 0 16px;background:var(--book-field);box-shadow:0 3px 10px #162f6510}
:root #bookDialog .book-overview-grid>.book-panel-card{margin:0}
:root #bookDialog .book-section-heading{margin-bottom:14px;gap:10px;align-items:flex-start}
:root #bookDialog .book-section-kicker{font-size:8px;letter-spacing:1.65px;color:var(--book-muted);margin-bottom:7px}
:root #bookDialog .book-panel-card h3{font-size:17px;letter-spacing:-.45px;color:var(--book-ink)}
:root #bookDialog .book-panel-card h4{color:var(--book-ink)}
:root #bookDialog .book-panel-card p{font-size:12px;line-height:1.85;color:var(--book-muted)}
:root #bookDialog .book-about-card{grid-column:1;grid-row:1;min-height:250px}
:root #bookDialog #bookSynopsis{white-space:pre-line;color:var(--book-ink);margin:0 0 20px;font-size:13px;line-height:1.85;overflow-wrap:anywhere;max-height:340px;overflow-y:auto;scrollbar-width:thin;padding-right:5px}
:root #bookDialog #bookSynopsis[data-empty="true"]{color:var(--book-muted)}
:root #bookDialog .book-text-action{padding:0;min-height:28px;font-size:11px;font-weight:600;color:var(--book-action);text-align:left}
:root #bookDialog .book-place-card{grid-column:2;grid-row:1;background:linear-gradient(135deg,var(--book-field),var(--book-panel))}
:root #bookDialog .book-about-card{background:linear-gradient(145deg,var(--book-field),#f2effa)}
:root #bookDialog .book-thoughts-card{background:linear-gradient(145deg,var(--book-field),#edf5fc)}
:root #bookDialog #bookSnapshotStatus{color:#276b64;background:#e4f2ed;border-radius:6px;font-size:9px;line-height:1.5;padding:4px 7px;white-space:normal;text-align:center}
:root #bookDialog #bookSnapshotProgress strong{display:block;font-size:27px;line-height:1.3;letter-spacing:-.7px;font-weight:650;color:var(--book-ink)}
:root #bookDialog #bookSnapshotProgress strong span{font-size:17px;color:var(--book-muted);font-weight:400}
:root #bookDialog #bookSnapshotProgress small{display:block;color:var(--book-muted);font-size:10px;margin-top:3px}
:root #bookDialog .book-snapshot-track{height:5px;background:var(--book-border);border-radius:6px;overflow:hidden;margin:13px 0 18px}
:root #bookDialog .book-snapshot-track>span{display:block;height:100%;background:linear-gradient(90deg,#5874df,#8f88e8);border-radius:6px}
:root #bookDialog .book-snapshot-dates{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:0 0 20px}
:root #bookDialog .book-snapshot-dates dt{font-size:9px;color:var(--book-muted);margin-bottom:6px}
:root #bookDialog .book-snapshot-dates dd{font-size:11px;font-weight:500;margin:0;color:var(--book-ink)}
:root #bookDialog .book-place-card>.button{width:100%;justify-content:space-between;border-radius:10px;box-shadow:none;font-size:11px;min-height:39px}
:root #bookDialog .book-thoughts-card{grid-column:1 / -1;grid-row:2}
:root #bookDialog .book-thoughts-card .book-section-heading{flex-wrap:wrap}
:root #bookDialog .book-note-preview{white-space:pre-wrap;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;margin:0;color:var(--book-ink)}
:root #bookDialog #bookThoughtsPreview blockquote{font-family:var(--serif);font-size:15px;line-height:1.6;margin:14px 0;padding:0 0 0 12px;border-left:2px solid #aca5e1;color:var(--book-ink);white-space:pre-wrap;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
:root #bookDialog .book-journal-count{display:block;font-size:10px;color:var(--book-muted);margin-top:12px}
:root #bookDialog .book-facts-card{grid-column:1 / -1}
:root #bookDialog .book-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px 24px;margin:0}
:root #bookDialog .book-facts dt{font-size:10px;color:var(--book-muted);margin-bottom:5px}
:root #bookDialog .book-facts dd{font-size:12px;color:var(--book-ink);line-height:1.5;margin:0;overflow-wrap:anywhere}
:root #bookDialog .book-reading-links{display:flex;flex-wrap:wrap;gap:10px}
:root #bookDialog .book-reading-links:not(:empty){border-top:1px solid var(--book-border);padding-top:16px;margin-top:20px}
:root #bookDialog .book-reading-links a{display:inline-flex;gap:10px;align-items:center;font-size:11px;color:var(--book-action);padding:8px 10px;background:var(--book-panel);border-radius:7px}
:root #bookDialog .book-share-card{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px;align-items:center;margin-top:16px;background:var(--book-panel);box-shadow:none;border-color:transparent}
:root #bookDialog .book-share-card h3{font-size:15px;margin-bottom:5px}
:root #bookDialog .book-share-card .book-section-kicker{display:none}
:root #bookDialog .book-share-card p{font-size:10px;line-height:1.6;margin:0;max-width:350px}
:root #bookDialog .book-share-card .book-export-actions{margin:0;gap:7px}
:root #bookDialog .book-share-card .button{font-size:10px;min-height:36px;padding:8px 10px;border-radius:8px;background:var(--book-field);color:var(--book-ink)}
:root #bookDialog .book-share-card .button.primary{background:var(--book-action);color:var(--book-action-text)}
:root #bookDialog .book-share-card .button.primary:hover{background:var(--book-action-hover)}
:root #bookDialog .book-share-card #bookExportMessage{grid-column:1/-1}
:root #bookDialog .book-imported-information{box-shadow:none}
:root #bookDialog .book-imported-information>summary{font-size:11px;color:var(--book-muted)}
:root #bookDialog .book-imported-information details>summary{font-size:10px}
:root #bookDialog .book-reading-launch{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:16px;background:linear-gradient(120deg,#eaeefa,#f0ebfa);border-color:#dfe3f6}
:root #bookDialog .book-reading-launch p{margin-bottom:0}
:root #bookDialog .book-reading-launch .book-inline-message{grid-column:1/-1}
:root #bookDialog .book-quick-actions{display:flex;gap:8px;margin:0 0 18px;border:0;padding:0}
:root #bookDialog .book-quick-actions button{display:inline-flex;align-items:center;gap:7px;flex:1;justify-content:center;border-radius:9px;border:1px solid var(--book-border);background:var(--book-field);padding:9px 8px;font-size:10px;color:var(--book-muted)}
:root #bookDialog .book-quick-actions svg{width:15px;height:15px;margin:0;filter:none;transform:none}
:root #bookDialog .book-quick-actions button:disabled{background:var(--book-panel);color:var(--book-action)}
:root #bookDialog .book-reading-stats{grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:0}
:root #bookDialog .book-reading-stats strong{font-size:23px;color:var(--book-ink)}
:root #bookDialog .book-journal-toolbar{border-radius:16px;background:var(--book-field);border:1px solid var(--book-border);padding:20px;margin-bottom:16px}
:root #bookDialog .book-journal-topic-actions{gap:6px}
:root #bookDialog .book-journal-topic-actions button{background:var(--book-panel);border-color:var(--book-border);font-size:10px;border-radius:8px}
:root #bookDialog .book-journal-entry{box-shadow:none}
:root #bookDialog .book-artwork-tools .book-art-editors{margin-top:16px}
:root #bookDialog .book-save-bar{position:sticky;bottom:0;z-index:9;margin:18px -28px -18px;padding:12px 28px 17px;background:var(--book-field);border-top:1px solid var(--book-border);display:flex;align-items:center;justify-content:space-between;gap:18px}
:root #bookDialog .book-save-hint{margin:0;max-width:340px;font-size:10px;line-height:1.6;color:var(--book-muted)}
:root #bookDialog .book-save-bar .dialog-footer{padding:0;margin:0;border:0;flex-shrink:0}
:root #bookDialog .book-save-bar .button{border-radius:9px;min-height:39px;font-size:11px;padding:10px 16px;box-shadow:none}
:root #bookDialog .book-delete-area{margin-top:26px;border-color:var(--book-border)}
:root #bookDialog .book-art-actions button{font-size:10px}
:root #bookDialog .book-read-history{margin:0;padding:0;list-style:none;display:grid;gap:14px}
:root #bookDialog .book-read-history li{display:flex;gap:12px;align-items:center;min-width:0}
:root #bookDialog .book-read-history .book-read-marker{display:grid;place-items:center;flex-shrink:0;width:30px;height:30px;border-radius:50%;background:var(--book-panel);color:var(--book-action);font-size:11px}
:root #bookDialog .book-read-history strong{font-size:12px;color:var(--book-ink);font-weight:600}
:root #bookDialog .book-read-history p{font-size:11px;margin:3px 0 0;overflow-wrap:anywhere}

html[data-app-theme="dark"] #bookDialog{--book-field:#17243c;--book-panel:#1e304d;--book-border:#2c3e5a;--book-ink:#e4ecfa;--book-muted:#a9b8d1;--book-action:#a3bcff;--book-action-hover:#c9d7ff;--book-action-text:#152644;background:#101d32!important}
html[data-app-theme="dark"] #bookDialog .book-reading-launch{background:linear-gradient(120deg,#223458,#2c2a48);border-color:var(--book-border)}
html[data-app-theme="dark"] #bookDialog .book-about-card{background:linear-gradient(145deg,#17243c,#272644)}
html[data-app-theme="dark"] #bookDialog .book-thoughts-card{background:linear-gradient(145deg,#17243c,#1b344a)}
html[data-app-theme="dark"] #bookDialog .book-meta-chips span{background:#283957;color:#c1d0ef}
html[data-app-theme="dark"] #bookDialog :is(#bookSnapshotStatus,.book-meta-chips span:first-child){background:#234441;color:#afe4d6}

@media(max-width:760px){
  :root #bookDialog{width:calc(100vw - 20px);max-width:calc(100vw - 20px);max-height:94dvh;border-radius:20px}
  :root #bookDialog #bookForm{padding:0 16px 14px}
  :root #bookDialog .dialog-header{margin-inline:-16px;padding:8px 16px;height:44px;min-height:44px}
  :root #bookDialog .book-detail-top{margin-inline:-16px;padding:12px 22px 24px;gap:20px}
  :root #bookDialog #detailCover{width:84px;height:116px}
  :root #bookDialog .book-detail-top h2{font-size:24px;letter-spacing:-.6px}
  :root #bookDialog .book-hero-label{font-size:7px;letter-spacing:1.5px;margin-bottom:8px}
  :root #bookDialog .book-hero-facts{grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}
  :root #bookDialog .book-hero-facts dd{font-size:10px}
  :root #bookDialog .book-hero-actions{margin-inline:-16px;padding:0 16px 16px;gap:6px}
  :root #bookDialog .book-hero-actions button{min-width:90px;min-height:40px}
  :root #bookDialog .book-detail-top p{font-size:12px}
  :root #bookDialog #detailRating{font-size:16px;margin:8px 0}
  :root #bookDialog .book-detail-tabs{margin-inline:-16px;padding-inline:16px;gap:4px;margin-bottom:16px;top:44px}
  :root #bookDialog .book-detail-tabs button{flex:1;padding:14px 5px;font-size:11px;min-height:46px}
  :root #bookDialog .book-overview-grid{display:flex;flex-direction:column;gap:12px}
  :root #bookDialog .book-overview-grid>.book-panel-card{width:100%}
  :root #bookDialog .book-place-card{order:-1}
  :root #bookDialog .book-about-card{min-height:0}
  :root #bookDialog .book-panel-card{padding:18px;border-radius:13px}
  :root #bookDialog #bookSynopsis{font-size:12px;max-height:260px}
  :root #bookDialog .book-facts{grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
  :root #bookDialog .book-share-card{grid-template-columns:1fr;padding:18px}
  :root #bookDialog .book-share-card .book-export-actions{flex-wrap:nowrap}
  :root #bookDialog .book-share-card .button{flex:1;width:auto}
  :root #bookDialog .book-reading-launch{grid-template-columns:1fr;gap:10px}
  :root #bookDialog .book-reading-launch>.button{width:100%}
  :root #bookDialog .book-quick-actions{display:grid;grid-template-columns:1fr 1fr}
  :root #bookDialog .book-reading-stats strong{font-size:19px}
  :root #bookDialog .book-save-bar{bottom:0;margin:14px -16px -14px;padding:12px 16px;gap:12px}
  :root #bookDialog .book-save-hint{font-size:9px;max-width:180px}
  :root #bookDialog .book-save-bar .dialog-footer{flex-wrap:wrap;justify-content:flex-end}
  :root #bookDialog .book-save-bar .button{padding:9px 12px;min-height:38px}
}

/* The desktop phone preview uses the same layout as the app's smaller screen. */
:root #bookDialog.compact-book-dialog{width:min(480px,calc(var(--book-dialog-width,100vw) - 24px));max-width:calc(var(--book-dialog-width,100vw) - 24px);max-height:min(860px,calc(var(--book-dialog-height,100dvh) - 24px))}
:root #bookDialog.compact-book-dialog #bookForm{padding:0 16px 14px}
:root #bookDialog.compact-book-dialog .dialog-header{margin-inline:-16px;padding:8px 16px;height:44px;min-height:44px}
:root #bookDialog.compact-book-dialog .book-detail-top{margin-inline:-16px;padding:12px 22px 24px;gap:20px}
:root #bookDialog.compact-book-dialog #detailCover{width:84px;height:116px}
:root #bookDialog.compact-book-dialog .book-detail-top h2{font-size:24px;letter-spacing:-.6px}
:root #bookDialog.compact-book-dialog .book-hero-label{font-size:7px;letter-spacing:1.5px;margin-bottom:8px}
:root #bookDialog.compact-book-dialog .book-hero-facts{grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}
:root #bookDialog.compact-book-dialog .book-hero-facts dd{font-size:10px}
:root #bookDialog.compact-book-dialog .book-hero-actions{margin-inline:-16px;padding:0 16px 16px;gap:6px}
:root #bookDialog.compact-book-dialog .book-hero-actions button{min-width:90px;min-height:40px}
:root #bookDialog.compact-book-dialog .book-detail-top p{font-size:12px}
:root #bookDialog.compact-book-dialog #detailRating{font-size:16px;margin:8px 0}
:root #bookDialog.compact-book-dialog .book-detail-tabs{margin-inline:-16px;padding-inline:16px;gap:4px;margin-bottom:16px;top:44px}
:root #bookDialog.compact-book-dialog .book-detail-tabs button{flex:1;padding:14px 5px;font-size:11px;min-height:46px}
:root #bookDialog.compact-book-dialog .book-panel-card{padding:18px;border-radius:13px}
:root #bookDialog.compact-book-dialog #bookSynopsis{font-size:12px;max-height:260px}
:root #bookDialog.compact-book-dialog .book-reading-launch{grid-template-columns:1fr;gap:10px}
:root #bookDialog.compact-book-dialog .book-reading-launch>.button{width:100%}
:root #bookDialog.compact-book-dialog .book-quick-actions{display:grid;grid-template-columns:1fr 1fr}
:root #bookDialog.compact-book-dialog .book-save-bar{bottom:0;margin:14px -16px -14px;padding:12px 16px;gap:12px}
:root #bookDialog.compact-book-dialog .book-save-hint{font-size:9px;max-width:180px}
:root #bookDialog.compact-book-dialog .book-save-bar .dialog-footer{flex-wrap:wrap;justify-content:flex-end}
:root #bookDialog.compact-book-dialog .book-save-bar .button{padding:9px 12px;min-height:38px}
:root #bookDialog.compact-book-dialog .book-overview-grid{display:flex;flex-direction:column;gap:12px}
:root #bookDialog.compact-book-dialog .book-overview-grid>.book-panel-card{width:100%}
:root #bookDialog.compact-book-dialog .book-place-card{order:-1}
:root #bookDialog.compact-book-dialog .book-about-card{min-height:0}
:root #bookDialog.compact-book-dialog .book-facts{grid-template-columns:repeat(2,minmax(0,1fr))}
:root #bookDialog.compact-book-dialog .book-share-card{grid-template-columns:1fr}
:root #bookDialog.compact-book-dialog .book-share-card .book-export-actions{flex-wrap:nowrap}
:root #bookDialog.compact-book-dialog .book-share-card .button{width:auto;flex:1}

:root .book-sharing-dialog{width:min(560px,calc(100vw - 24px));max-width:calc(100vw - 24px);max-height:90dvh;overflow:auto;padding:24px;border:1px solid #dce2f3;border-radius:22px;background:linear-gradient(145deg,#f2effb,#f6faff)!important;color:#263653;font-family:var(--books-font,var(--sans));box-shadow:0 30px 100px #14224755}
.book-sharing-dialog::backdrop{background:#111c3d94;backdrop-filter:blur(8px)}
.book-sharing-dialog .sharing-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:20px}
.book-sharing-dialog .sharing-heading h2{font-size:24px;letter-spacing:-.7px;margin:6px 0 0;color:inherit}
.book-sharing-dialog .sharing-brand{font-size:9px;letter-spacing:1.3px;color:#6372a5;font-weight:600}
.book-sharing-dialog [data-sharing-close]{width:32px;height:32px;flex-shrink:0;border-radius:50%;background:#e4e8f5;color:inherit;font-size:22px}
.book-share-preview{display:flex;align-items:center;gap:16px;padding:16px;border:1px solid #dce2f3;border-radius:12px;background:#ffffffaa;margin-bottom:18px}
.book-share-preview img{width:48px;height:67px;object-fit:cover;border-radius:3px;flex-shrink:0}
.book-share-preview strong{display:block;font-size:15px;line-height:1.5;overflow-wrap:anywhere}
.book-share-preview span{display:block;font-size:12px;color:#6a7790;margin-top:4px}
.book-sharing-dialog label{display:flex;flex-direction:column;gap:7px;font-size:12px;font-weight:500;margin:14px 0;color:inherit}
.book-sharing-dialog label>span{font-size:10px;font-weight:400}
.book-sharing-dialog :is(input:not([type=checkbox]),textarea){width:100%;min-width:0;box-sizing:border-box;border:1px solid #dce2f3;border-radius:9px;padding:11px 12px;font:inherit;background:#fff;color:#263653}
.book-sharing-dialog label.sharing-check{flex-direction:row;align-items:center;gap:10px;font-size:11px;line-height:1.6}
.book-sharing-dialog .sharing-check input{width:17px;height:17px;flex-shrink:0;margin:0;accent-color:#5266cc}
.book-sharing-dialog .sharing-option{border-top:1px solid #dce2f3;padding-top:16px;margin-top:20px}
.book-sharing-dialog .sharing-option h3{font-size:15px;color:inherit;margin:0 0 6px}
.book-sharing-dialog p{font-size:12px;line-height:1.7;color:#63718c;overflow-wrap:anywhere}
.book-sharing-dialog .sharing-buttons{display:flex;flex-wrap:wrap;gap:8px}
.book-sharing-dialog .button{border-radius:9px;padding:10px 14px;font-size:12px;min-height:40px}
.book-sharing-dialog .primary{background:#5266cc;color:#fff}
.book-sharing-dialog .light{border:1px solid #d3dbf0;background:#fff;color:#4157b5}
.book-sharing-dialog .book-text-action{color:#5266cc;font-size:11px}
.book-sharing-dialog #bookShareStatus,.book-sharing-dialog #sharedBookStatus{margin-bottom:0;color:#4157b5}
.book-sharing-dialog blockquote{margin:18px 0;padding:14px 16px;border-left:3px solid #9596da;background:#ffffff70;font-size:13px;line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere}
.book-sharing-dialog .sharing-description{white-space:pre-wrap}
.book-sharing-dialog .sharing-facts{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:20px 0}
.book-sharing-dialog .sharing-facts dt{font-size:10px;color:#6b7890;margin-bottom:4px}
.book-sharing-dialog .sharing-facts dd{margin:0;font-size:12px;overflow-wrap:anywhere}
.book-message-row{display:block;width:100%;padding:16px;text-align:left;border:1px solid #dce2f3;border-radius:12px;background:#ffffffaa;margin:10px 0;color:inherit}
.book-message-row>span,.book-message-row small{display:block;font-size:10px;color:#6b7890}
.book-message-row>strong{display:block;font-size:14px;margin-top:7px}
.book-message-row p{margin:5px 0;white-space:pre-wrap}
.book-messages-entry{display:block;margin:12px 0 16px auto;padding:10px 15px;border:1px solid var(--line);border-radius:10px;background:var(--paper);color:var(--accent);font:600 12px var(--sans)}
html[data-app-theme=dark] .book-sharing-dialog{background:linear-gradient(145deg,#212841,#152f44)!important;color:#e2ecfb;border-color:#3c4e70}
html[data-app-theme=dark] .book-sharing-dialog :is(.book-share-preview,.book-message-row,blockquote){background:#17243c;border-color:#3c4e70}
html[data-app-theme=dark] .book-sharing-dialog :is(input:not([type=checkbox]),textarea,.light){background:#17243c;color:#dbe8ff;border-color:#3c4e70}
html[data-app-theme=dark] .book-sharing-dialog :is(p,.sharing-brand,.sharing-facts dt,.book-share-preview span,.book-message-row>span,.book-message-row small){color:#afc1e0}
@media(max-width:760px){:root .book-sharing-dialog{padding:18px;border-radius:18px}.book-sharing-dialog :is(input,textarea){font-size:16px!important}}

/* Full reading player. The compact dock keeps its existing appearance. */
:root #readingTimerDialog{
  --timer-soft:#edf0fa;--timer-field:#fff;--timer-border:#dce3f1;
  --timer-action:#5265cf;--timer-on-action:#fff;--timer-blue:#34477e;
  --timer-play:#5265cf;--timer-play-ink:#fff;--timer-control-soft:#e9edf9;
  border:1px solid #ffffff55;border-radius:24px;background:linear-gradient(145deg,#f2effb,#edf7fb)!important;
  box-shadow:0 30px 100px #10204666;
}
:root #readingTimerDialog::backdrop{background:#111c3d99;backdrop-filter:blur(10px)}
:root #readingTimerDialog .reading-timer-hero{height:178px;background:radial-gradient(ellipse at 95% 15%,#7a79c166,transparent 65%),linear-gradient(120deg,#182447,#29436d);display:flex;align-items:center;gap:24px;padding:30px}
:root #readingTimerDialog .reading-timer-hero:after{display:none}
:root #readingTimerDialog #readingTimerCover{width:82px;height:116px;flex-shrink:0;overflow:hidden;border-radius:5px;transform:rotate(-4deg);box-shadow:5px 9px 22px #06132970,0 0 0 1px #ffffff30}
:root #readingTimerDialog #readingTimerCover .cover-art{width:100%;height:100%;padding:9px;justify-content:center}
:root #readingTimerDialog #readingTimerCover img{object-fit:contain;background:#182447}
:root #readingTimerDialog #readingTimerCover .cover-title{font-size:13px;line-height:1.25;max-width:100%;margin:auto}
:root #readingTimerDialog #readingTimerCover .cover-symbol{font-size:24px}
:root #readingTimerDialog #readingTimerCover .cover-kicker,:root #readingTimerDialog #readingTimerCover .cover-author{font-size:5px;letter-spacing:.5px}
:root #readingTimerDialog .reading-timer-hero-tag{position:static;font-size:9px;letter-spacing:1.8px;color:#bfcced;line-height:1.8;max-width:210px;padding-right:20px}
:root #readingTimerDialog .reading-timer-hero-tag:after{content:'Make room for a chapter.';display:block;font-size:24px;line-height:1.25;letter-spacing:-.6px;text-transform:none;font-weight:500;color:#fff;margin-top:10px}
:root #readingTimerDialog .reading-timer-close{background:#ffffff14;color:#e6edff;border:1px solid #ffffff24;width:33px;height:33px;right:14px;top:14px;box-shadow:none}
:root #readingTimerDialog .reading-timer-close:hover{background:#ffffff2b}
:root #readingTimerDialog .reading-timer-body{padding:26px 28px;background:transparent}
:root #readingTimerDialog .reading-timer-book-meta{max-width:100%;margin-bottom:22px}
:root #readingTimerDialog .reading-timer-book-meta h2{color:#263653;font-size:22px;letter-spacing:-.6px;line-height:1.4}
:root #readingTimerDialog #readingTimerAuthor{font-size:12px;color:#72809a;margin-top:6px}
:root #readingTimerDialog .reading-timer-phase{color:#6e78a4;font-size:9px;letter-spacing:2px}
:root #readingTimerDialog .reading-timer-clock{font-size:clamp(42px,13vw,76px);font-weight:500;letter-spacing:-3px;color:#34477e;margin:12px 0 22px;font-variant-numeric:tabular-nums;line-height:1.2;text-shadow:0 3px 18px #929adb20}
:root #readingTimerDialog .reading-timer-controls{gap:10px;margin-bottom:20px}
:root #readingTimerDialog .reading-timer-controls .button{min-height:48px;border-radius:12px;font-size:13px;max-width:none;padding:12px 16px}
:root #readingTimerDialog .reading-timer-controls .button.primary{background:linear-gradient(120deg,#5265cf,#7b76cf);box-shadow:0 5px 15px #5265cf22}
:root #readingTimerDialog .reading-timer-controls .button.light{border:1px solid #d7def0;background:#ffffffa8;color:#5265ad}
:root #readingTimerDialog .reading-timer-from{color:#72809a;font-size:11px}
:root #readingTimerDialog #readingTimerFrom{border-radius:8px;background:var(--timer-field);min-height:34px}
:root #readingTimerDialog .reading-timer-tools{padding:10px 0 14px;margin:8px 0 0;border-color:var(--timer-border)}
:root #readingTimerDialog .reading-timer-tools button{font-size:11px}
:root #readingTimerDialog .reading-timer-notes{padding:18px;margin-top:18px;background:#ffffffa8;border:1px solid #e0e5f3;border-radius:15px}
:root #readingTimerDialog .reading-timer-notes h3{font-size:14px;color:#344466;margin:0}
:root #readingTimerDialog .reading-timer-notes .book-section-heading{margin-bottom:14px}
:root #readingTimerDialog #readingTimerNoteCount{font-size:10px;color:#7c86a0}
:root #readingTimerDialog .reading-timer-note-label{font-size:10px;color:#72809a}
:root #readingTimerDialog #readingTimerNote{border:1px solid var(--timer-border);border-radius:10px;font-size:13px;min-height:78px;background:var(--timer-field)}
:root #readingTimerDialog #readingTimerAddNote{background:var(--timer-soft);border-radius:8px;font-size:11px}
:root #readingTimerDialog #readingTimerNotes article{border-left:2px solid #a49bdc;border-radius:0 10px 10px 0}
:root #readingTimerDialog .reading-timer-finish{background:#ffffffa8;border-color:var(--timer-border);border-radius:15px}
:root #readingTimerDialog #readingTimerSyncStatus{font-size:10px;color:#72809a;text-align:center;padding-top:4px}
html[data-app-theme=dark] #readingTimerDialog{--timer-soft:#253552;--timer-field:#18283e;--timer-border:#35496a;--timer-action:#acbcff;--timer-on-action:#15213b;--timer-play-ink:#fff;background:linear-gradient(145deg,#20283f,#172e42)!important}
html[data-app-theme=dark] #readingTimerDialog :is(.reading-timer-notes,.reading-timer-finish){background:#18283ecc;border-color:var(--timer-border)}
html[data-app-theme=dark] #readingTimerDialog :is(.reading-timer-book-meta h2,.reading-timer-notes h3){color:#e5edff}
html[data-app-theme=dark] #readingTimerDialog .reading-timer-clock{color:#c8d3ff}
html[data-app-theme=dark] #readingTimerDialog :is(#readingTimerAuthor,.reading-timer-from,.reading-timer-phase,.reading-timer-note-label,#readingTimerNoteCount,#readingTimerSyncStatus){color:#aebfda}
html[data-app-theme=dark] #readingTimerDialog .reading-timer-controls .button.light{background:#263754;border-color:#3a4f72;color:#c8d3ff}
@media(max-width:480px){
  :root #readingTimerDialog .reading-timer-hero{height:150px;padding:22px;gap:20px}
  :root #readingTimerDialog #readingTimerCover{width:68px;height:96px}
  :root #readingTimerDialog .reading-timer-hero-tag{font-size:8px;letter-spacing:1.2px}
  :root #readingTimerDialog .reading-timer-hero-tag:after{font-size:21px}
  :root #readingTimerDialog .reading-timer-body{padding:22px 18px}
  :root #readingTimerDialog .reading-timer-book-meta h2{font-size:19px}
  :root #readingTimerDialog #readingTimerNote{font-size:16px}
}

/* Current position can be corrected without adding a reading session. */
:root #bookDialog .book-page-editor { margin:14px 0;padding:16px;border:1px solid var(--border, #d9d4e6);border-radius:16px;background:var(--surface, #fff);color:var(--text, #302a40); }
:root #bookDialog .book-page-editor[hidden] { display:none; }
:root #bookDialog .book-page-editor p { font-size:.82rem;line-height:1.5; }
:root #bookDialog .book-page-editor label { display:grid;gap:6px;margin:12px 0; }
:root #bookDialog .book-page-editor input { width:100%;box-sizing:border-box;min-height:44px; }
:root #bookDialog .book-page-editor > div { display:flex;gap:8px;flex-wrap:wrap; }
:root #bookDialog #bookPageError { color:#ba354b; }
:root #bookDialog #bookUpdatePage { margin-bottom:10px; }
html[data-app-theme=dark] #bookDialog .book-page-editor { background:#17243c;color:#e2ecfb;border-color:#3c4e70; }

.book-unsaved-dialog { width:min(430px,calc(100vw - 32px));box-sizing:border-box;padding:26px;border:1px solid #c9cce4;border-radius:22px;background:linear-gradient(135deg,#f4f0ff,#edf6fa);color:#283652;box-shadow:0 24px 80px #101c4655; }
.book-unsaved-dialog::backdrop { background:#10182e88;backdrop-filter:blur(4px); }
.book-unsaved-dialog h2 { margin:10px 0;font-size:24px; }
.book-unsaved-dialog p { font-size:14px;line-height:1.6; }
.book-unsaved-actions { display:flex;flex-wrap:wrap;gap:10px;margin-top:22px; }
.book-unsaved-actions .button { min-height:44px; }
html[data-app-theme=dark] .book-unsaved-dialog { background:linear-gradient(135deg,#222b46,#173445);color:#e2ecfb;border-color:#3c4e70; }

/* A personal reading scrapbook, with space for each kind of memory. */
:root #bookDialog .book-journal-toolbar { position:relative;overflow:hidden;padding:26px;background:radial-gradient(ellipse at 100% 0,#b7dbea55,transparent 60%),linear-gradient(135deg,#ece8fc,#f6f3fc 65%,#e9f2f7);border-color:#dcdcf0; }
:root #bookDialog .book-journal-toolbar h3 { font:clamp(22px,4vw,30px)/1.2 Georgia,serif;color:var(--book-ink);margin-top:6px; }
:root #bookDialog .book-journal-invitation { max-width:530px;font-size:13px;line-height:1.7;color:var(--book-muted);margin:12px 0 18px; }
:root #bookDialog #bookJournalEntryCount { border:1px solid var(--book-border);border-radius:30px;padding:6px 10px;white-space:nowrap;font-size:11px;background:var(--book-field); }
:root #bookDialog .book-journal-highlights { display:flex;gap:26px;flex-wrap:wrap;padding:0 0 20px;border-bottom:1px solid var(--book-border); }
:root #bookDialog .book-journal-highlights span { display:grid;gap:4px;font-size:11px;color:var(--book-muted); }
:root #bookDialog .book-journal-highlights strong { font:25px Georgia,serif;color:var(--book-ink); }
:root #bookDialog .book-journal-prompt-title { margin:20px 0 12px;font-size:13px; }
:root #bookDialog .book-journal-topic-actions { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px; }
:root #bookDialog .book-journal-topic-actions button { display:flex;align-items:flex-start;gap:10px;text-align:left;padding:14px 11px;border:1px solid var(--book-border);border-radius:14px;background:var(--book-field);min-height:92px;color:var(--book-ink);transition:transform .15s,border-color .15s; }
:root #bookDialog .book-journal-topic-actions button:hover { transform:translateY(-2px);border-color:#9b94cd; }
:root #bookDialog .book-journal-topic-actions button:focus-visible { outline:2px solid var(--book-action);outline-offset:3px; }
:root #bookDialog .journal-prompt-icon { display:grid;place-items:center;flex:0 0 28px;height:30px;border-radius:9px;background:#e9e5fa;color:#6c58ac;font-size:21px;font-family:Georgia,serif; }
:root #bookDialog .book-journal-topic-actions strong { display:block;font-size:12px;margin:2px 0 5px; }
:root #bookDialog .book-journal-topic-actions small { display:block;color:var(--book-muted);font-size:10px;line-height:1.5; }
:root #bookDialog .book-journal-filter { margin-top:20px; }
:root #bookDialog .book-journal-entries { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start;margin-top:20px; }
:root #bookDialog .book-journal-entry { --memory-accent:#9c8dce;position:relative;min-width:0;margin:0;padding:22px 20px;border:1px solid var(--book-border);border-top:4px solid var(--memory-accent);border-radius:5px 16px 16px 16px;background:var(--book-field);box-shadow:0 5px 16px #28365206; }
:root #bookDialog .book-journal-entry[data-journal-topic=Quotes] { --memory-accent:#c09a59;background:linear-gradient(135deg,#fbf4e655,var(--book-field)); }
:root #bookDialog .book-journal-entry[data-journal-topic=Characters] { --memory-accent:#c58b9f; }
:root #bookDialog .book-journal-entry[data-journal-topic=Worldbuilding] { --memory-accent:#6ca6a5; }
:root #bookDialog .book-journal-entry[data-journal-topic=Plot] { --memory-accent:#729ccb; }
:root #bookDialog .book-journal-entry-meta { display:flex;gap:8px;align-items:center;flex-wrap:wrap; }
:root #bookDialog .book-journal-entry-meta>span:first-child { font-size:10px;font-weight:700;letter-spacing:.5px;color:var(--book-ink); }
:root #bookDialog .book-journal-entry-meta small { flex-basis:100%;font-size:10px;color:var(--book-muted); }
:root #bookDialog .book-journal-entry h4 { font:19px/1.4 Georgia,serif;margin:16px 0 8px;overflow-wrap:anywhere; }
:root #bookDialog .book-journal-entry p { font-size:13px;line-height:1.85;white-space:pre-wrap;overflow-wrap:anywhere;margin:14px 0 20px; }
:root #bookDialog .book-journal-entry[data-journal-topic=Quotes] p { font:18px/1.7 Georgia,serif; }
:root #bookDialog .book-journal-entry-actions { padding-top:12px;border-top:1px dashed var(--book-border);display:flex;justify-content:space-between;gap:12px; }
:root #bookDialog .book-journal-entry-actions button { min-height:38px;font-size:11px; }
:root #bookDialog .book-journal-empty { grid-column:1/-1;text-align:center;padding:35px 22px;border:1px dashed var(--book-border);border-radius:18px;background:var(--book-field); }
:root #bookDialog .book-journal-empty>span { font:38px Georgia,serif;color:#9480bd; }
:root #bookDialog .book-journal-empty h4 { font:22px Georgia,serif;margin:12px 0; }
:root #bookDialog .book-journal-empty p { max-width:390px;margin:auto;color:var(--book-muted);font-size:13px;line-height:1.7; }
:root #bookDialog #bookJournalComposer { margin-top:18px;border:1px solid #aaa0d5;border-radius:18px;background:var(--book-field); }
:root #bookDialog .book-journal-compose-heading h3 { font:23px/1.3 Georgia,serif;margin:10px 0; }
:root #bookDialog .book-journal-compose-heading p { font-size:12px;line-height:1.6;color:var(--book-muted);margin-bottom:20px; }
html[data-app-theme=dark] #bookDialog .book-journal-toolbar { background:radial-gradient(ellipse at 100% 0,#32658055,transparent 60%),linear-gradient(135deg,#302e4e,#1d3046);border-color:var(--book-border); }
html[data-app-theme=dark] #bookDialog .journal-prompt-icon { background:#3e3a60;color:#d6c7ff; }
@media(max-width:600px){:root #bookDialog .book-journal-toolbar{padding:18px}:root #bookDialog .book-journal-topic-actions{grid-template-columns:repeat(2,minmax(0,1fr))}:root #bookDialog .book-journal-entries{grid-template-columns:minmax(0,1fr)}:root #bookDialog .book-journal-highlights{gap:20px}}
:root #bookDialog.compact-book-dialog .book-journal-topic-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
:root #bookDialog.compact-book-dialog .book-journal-entries{grid-template-columns:minmax(0,1fr)}
@media(prefers-reduced-motion:reduce){:root #bookDialog .book-journal-topic-actions button{transition:none}}

/* Compact journal: counts, actions, then a filterable list. */
:root #bookDialog .book-journal-toolbar { padding:16px 18px;margin-bottom:12px;background:var(--book-panel);border:1px solid var(--book-border); }
:root #bookDialog .book-journal-highlights { gap:28px;padding:0 0 14px; }
:root #bookDialog .book-journal-highlights span { font-size:11px;gap:2px; }
:root #bookDialog .book-journal-highlights strong { font:600 22px var(--sans,sans-serif); }
:root #bookDialog .book-journal-topic-actions,:root #bookDialog.compact-book-dialog .book-journal-topic-actions { display:flex;flex-wrap:wrap;gap:7px;margin-top:14px; }
:root #bookDialog .book-journal-topic-actions button { display:block;min-height:38px;padding:8px 12px;border-radius:9px;font-size:12px;font-weight:600; }
:root #bookDialog .book-journal-topic-actions button:hover { transform:none;background:var(--book-panel); }
:root #bookDialog .book-journal-list-heading { display:flex;align-items:center;justify-content:space-between;gap:12px;margin:16px 0 8px; }
:root #bookDialog #bookJournalEntryCount { background:none;border:0;padding:0;color:var(--book-muted);font-size:11px; }
:root #bookDialog .book-journal-filter { display:flex;align-items:center;gap:8px;margin:0;font-size:11px; }
:root #bookDialog .book-journal-filter select { width:auto;min-height:36px;padding:6px 28px 6px 10px;margin:0; }
:root #bookDialog .book-journal-entries,:root #bookDialog.compact-book-dialog .book-journal-entries { display:block;margin-top:0; }
:root #bookDialog .book-journal-entry { padding:12px 14px;margin:0 0 8px;border:1px solid var(--book-border);border-left:3px solid var(--memory-accent);border-radius:8px;box-shadow:none;background:var(--book-field); }
:root #bookDialog .book-journal-entry[data-journal-topic=Quotes] { background:var(--book-field); }
:root #bookDialog .book-journal-entry-meta { gap:8px; }
:root #bookDialog .book-journal-entry-meta small { flex-basis:auto;margin-left:auto;font-size:10px; }
:root #bookDialog .book-journal-entry h4 { font:600 13px/1.4 var(--sans,sans-serif);margin:8px 0 4px; }
:root #bookDialog .book-journal-entry p,:root #bookDialog .book-journal-entry[data-journal-topic=Quotes] p { font:13px/1.6 var(--sans,sans-serif);margin:6px 0 8px; }
:root #bookDialog .book-journal-entry-actions { border:0;padding:0;justify-content:flex-end;gap:14px; }
:root #bookDialog .book-journal-entry-actions button { font-size:10px;min-height:32px;padding:3px 0;background:none;border:0; }
:root #bookDialog .book-journal-empty { margin:0;padding:18px;font-size:12px;text-align:center;color:var(--book-muted); }
:root #bookDialog #bookJournalComposer { padding:16px;margin:12px 0; }
html[data-app-theme=dark] #bookDialog .book-journal-toolbar { background:var(--book-panel); }
:root #bookDialog .book-journal-entry-meta { margin-bottom:4px; }
:root #bookDialog .book-journal-entry-actions { margin-top:0; }
:root #bookDialog .book-journal-list-heading { justify-content:flex-end; }
:root #bookDialog .book-journal-topic-actions { margin-bottom:0; }

:root #bookDialog .book-digital-links { display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:14px; }
:root #bookDialog .book-digital-links a { display:inline-flex;align-items:center;gap:7px;min-height:40px;padding:8px 11px;box-sizing:border-box;background:#ffffff14;border:1px solid #c2d4ff55;border-radius:10px;color:#eef3ff;text-decoration:none;font-size:11px;font-weight:600; }
:root #bookDialog .book-digital-links a[hidden] { display:none; }
:root #bookDialog .book-digital-links a:hover { background:#ffffff28; }
:root #bookDialog .book-digital-links svg { width:19px;height:19px;flex-shrink:0; }
:root #bookDialog #bookLinkDigitalCopy { min-height:40px;padding:8px 4px;background:transparent;border:0;color:#c5d5f8;font-size:11px;text-decoration:underline;text-underline-offset:3px; }
:root #bookDialog .book-digital-links :is(a,button):focus-visible { outline:2px solid #d3dfff;outline-offset:3px; }
:root #bookDialog .book-digital-help { color:var(--book-muted);font-size:12px;line-height:1.6;margin:14px 0; }

/* Digital copies share a full-width row beneath the book identity. */
:root #bookDialog .book-detail-top { flex-wrap:wrap; }
:root #bookDialog .book-digital-links { flex:0 0 100%;display:grid;grid-template-columns:max-content max-content;gap:8px;margin-top:0; }
:root #bookDialog .book-digital-links a { white-space:nowrap;min-height:44px; }
:root #bookDialog .book-digital-links svg { color:#d3b6ff;background:#9762ec38;border-radius:7px;padding:5px;box-sizing:content-box; }
:root #bookDialog #bookLinkDigitalCopy { grid-column:1/-1;justify-self:start;min-height:32px; }
@media(max-width:600px){:root #bookDialog .book-digital-links{grid-template-columns:repeat(2,minmax(0,1fr))}:root #bookDialog .book-digital-links a{justify-content:center;padding:6px;gap:5px;font-size:10px}}
:root #bookDialog.compact-book-dialog .book-digital-links{grid-template-columns:repeat(2,minmax(0,1fr))}
:root #bookDialog.compact-book-dialog .book-digital-links a{justify-content:center;padding:6px;gap:5px;font-size:10px}
:root #bookDialog .book-share-card>div { min-width:0; }
:root #bookDialog .book-share-card .book-export-actions { flex-wrap:wrap; }

/* Colorful journal totals double as shortcuts to each kind of memory. */
:root #bookDialog .book-reflection-counts { display:grid;grid-template-columns:repeat(auto-fit,minmax(88px,1fr));gap:8px;margin:16px 0; }
:root #bookDialog .book-reflection-total { --reflection-color:#655afb;display:grid;grid-template-columns:minmax(0,1fr);align-items:center;gap:5px;padding:12px 10px;min-width:0;border:1px solid color-mix(in srgb,var(--reflection-color) 18%,var(--book-border));border-top:3px solid var(--reflection-color);border-radius:11px;background:color-mix(in srgb,var(--reflection-color) 7%,var(--book-field));color:var(--book-ink);text-align:center; }
:root #bookDialog .book-reflection-total strong { font:700 24px/1.1 var(--sans,sans-serif);justify-self:center;color:color-mix(in srgb,var(--reflection-color) 65%,var(--book-ink)); }
:root #bookDialog .book-reflection-total>span:last-child { grid-column:1/-1;font-size:10px;font-weight:600;line-height:1.3; }
:root #bookDialog [data-reflection-topic=Review] { --reflection-color:#7c73fb; }
:root #bookDialog [data-reflection-topic=Characters] { --reflection-color:#8c60fc; }
:root #bookDialog [data-reflection-topic=Plot] { --reflection-color:#4f6afc; }
:root #bookDialog [data-reflection-topic=Worldbuilding] { --reflection-color:#0369fd; }
:root #bookDialog [data-reflection-topic=Quotes] { --reflection-color:#a37bfb; }
:root #bookDialog [data-reflection-topic=reading] { --reflection-color:#0083fe; }
:root #bookDialog .book-reflection-total:hover { filter:brightness(.97);border-color:var(--reflection-color); }
:root #bookDialog .book-reflection-total:focus-visible { outline:2px solid var(--book-action);outline-offset:3px; }
html[data-app-theme=dark] #bookDialog .book-reflection-total { background:color-mix(in srgb,var(--reflection-color) 12%,var(--book-field));color:var(--book-ink); }
html[data-app-theme=dark] #bookDialog .book-reflection-total strong { color:color-mix(in srgb,var(--reflection-color) 40%,#eef3ff); }
:root #bookDialog .book-about-card .book-metadata-notice { margin:14px 0 6px;font-size:10px;line-height:1.6;color:var(--book-muted); }
:root #bookDialog .book-meta-chips { display:flex;flex-wrap:wrap;gap:6px; }

:root #bookDialog .book-origin-info { padding:10px 12px;border:1px solid var(--book-border);border-radius:10px;background:var(--book-panel); }
:root #bookDialog .book-origin-info>span { font-size:10px;color:var(--book-muted); }
:root #bookDialog .book-origin-value { margin:4px 0 0;font-size:12px;font-weight:600;color:var(--book-ink); }
:root #bookDialog .book-genre-picker { min-width:0;margin:4px 0 0;padding:0;border:0; }
:root #bookDialog .book-genre-picker legend { font-size:12px;font-weight:600;margin-bottom:10px; }
:root #bookDialog .book-genre-choices { display:flex;flex-wrap:wrap;gap:7px;margin-bottom:14px; }
:root #bookDialog .book-genre-choices label { display:flex;align-items:center;gap:7px;padding:8px 10px;min-height:38px;box-sizing:border-box;margin:0;border:1px solid var(--book-border);border-radius:9px;background:var(--book-field);font-size:11px;cursor:pointer; }
:root #bookDialog .book-genre-choices label:has(input:checked) { background:color-mix(in srgb,var(--book-action) 10%,var(--book-field));border-color:var(--book-action); }
:root #bookDialog .book-genre-choices input { width:15px;height:15px;margin:0;accent-color:var(--book-action);flex-shrink:0; }
:root #bookDialog .book-genre-choices label:focus-within { outline:2px solid var(--book-action);outline-offset:2px; }
:root #bookDialog .book-custom-genre-row { display:flex;align-items:center;gap:8px;margin:6px 0; }
:root #bookDialog .book-custom-genre-row input { flex:1;min-width:0;margin:0; }
:root #bookDialog .book-custom-genre-row .button { flex-shrink:0;min-height:40px; }
:root #bookDialog .book-genre-picker>small { font-size:10px;color:var(--book-muted); }

:root #bookDialog .book-genre-dropdown { border:1px solid var(--book-border);border-radius:11px;background:var(--book-field);overflow:hidden; }
:root #bookDialog .book-genre-dropdown>summary { padding:12px 14px;cursor:pointer;font-size:12px;font-weight:600;color:var(--book-ink);min-height:44px;box-sizing:border-box; }
:root #bookDialog #bookGenreSelectionCount { float:right;margin-left:8px;font-size:11px;font-weight:400;color:var(--book-muted); }
:root #bookDialog .book-genre-dropdown>summary:focus-visible { outline:2px solid var(--book-action);outline-offset:-3px;border-radius:10px; }
:root #bookDialog .book-genre-dropdown[open]>summary { border-bottom:1px solid var(--book-border); }
:root #bookDialog .book-genre-dropdown-content { padding:14px; }
:root #bookDialog .book-genre-dropdown .book-genre-choices { max-height:220px;overflow-y:auto;overscroll-behavior:contain;padding:3px; }
:root #bookDialog .book-genre-dropdown-content>small { color:var(--book-muted);font-size:10px; }

/* Clear, persistent feedback beside the save action. */
:root #bookDialog .book-save-bar{flex-wrap:wrap;gap:10px 16px;box-shadow:0 -6px 20px #14243a10}
:root #bookDialog #bookError{flex:1 0 100%;margin:0;padding:12px 14px;border:1px solid #e79b9b;border-left:4px solid #c33737;border-radius:10px;background:#fff0f0;color:#9a2020;font-size:14px;font-weight:600;line-height:1.5;overflow-wrap:anywhere}
:root #bookDialog #bookError:empty{display:none}
:root #bookDialog .book-save-information{flex:1 1 190px}
:root #bookDialog .book-save-hint{font-size:13px;font-weight:600;line-height:1.5;margin:0;color:var(--book-ink,var(--ink))}
:root #bookDialog #bookCloudSaveStatus{font-size:12px;line-height:1.5;margin:6px 0 0;padding:7px 10px;border-radius:8px;background:var(--accent-soft);color:var(--ink);overflow-wrap:anywhere}
:root #bookDialog #bookCloudSaveStatus:empty{display:none}
:root #bookDialog #bookCloudSaveStatus[data-state="saved"]{background:#e7f5eb;color:#236239}
:root #bookDialog #bookCloudSaveStatus:is([data-state="error"],[data-state="conflict"],[data-state="capacity"]){background:#fff0f0;color:#9a2020;font-weight:600}
:root #bookDialog #bookCloudSaveStatus:is([data-state="offline"],[data-state="pending"]){background:#fff3d9;color:#79500d}
:root #bookDialog .book-save-bar .button{min-height:44px;font-size:13px}
:root #bookDialog #bookSaveButton[data-saved="true"]{background:#277144;border-color:#277144;color:#fff}
html[data-app-theme="dark"] #bookDialog #bookError,html[data-app-theme="dark"] #bookDialog #bookCloudSaveStatus:is([data-state="error"],[data-state="conflict"],[data-state="capacity"]){background:#42262c;color:#ffc4c4;border-color:#a95c68}
html[data-app-theme="dark"] #bookDialog #bookCloudSaveStatus[data-state="saved"]{background:#1c392b;color:#acf0c1}
html[data-app-theme="dark"] #bookDialog #bookCloudSaveStatus:is([data-state="offline"],[data-state="pending"]){background:#3e321d;color:#ffe0a1}

/* Make the current-page action visibly interactive in both themes. */
:root #bookDialog #bookUpdatePage{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:11px 16px;margin:8px 0 12px;border:1px solid var(--book-action,var(--accent));border-radius:10px;background:var(--accent-soft);color:var(--book-action,var(--accent));font-size:13px;font-weight:600;line-height:1.4;cursor:pointer;transition:background .15s,box-shadow .15s}
:root #bookDialog #bookUpdatePage:hover{background:var(--book-action,var(--accent));color:#fff;box-shadow:0 3px 10px #10244020}
:root #bookDialog #bookUpdatePage:focus-visible{outline:2px solid var(--book-action,var(--accent));outline-offset:3px}
:root #bookDialog #bookUpdatePage:active{box-shadow:inset 0 1px 3px #10244030}

.reading-celebration{position:fixed;inset:auto 12px max(18px,env(safe-area-inset-bottom)) auto;box-sizing:border-box;width:min(410px,calc(100vw - 24px));margin:0;padding:18px 44px 18px 18px;display:grid;grid-template-columns:42px minmax(0,1fr);gap:12px;border:1px solid var(--line);border-radius:18px;background:var(--surface,var(--paper));color:var(--ink);box-shadow:0 12px 50px #152b4040;z-index:3000;overflow:hidden;animation:reading-celebration-in .25s ease-out}
.reading-celebration-copy{min-width:0}.reading-celebration strong{font-size:15px;line-height:1.4;display:block}.reading-celebration p{font-size:13px;margin:5px 0;line-height:1.5;overflow-wrap:anywhere}.reading-celebration small{display:block;font-size:11px;line-height:1.5;color:var(--muted)}
.reading-celebration-art{align-self:start;display:grid;place-items:center;width:42px;min-height:42px;border-radius:12px;background:var(--accent-soft);color:var(--accent);font-size:24px}.reading-celebration-art .cover-art{width:42px;height:60px;overflow:hidden;border-radius:5px}.reading-celebration-art img{width:100%;height:100%;object-fit:cover}
.reading-celebration-close{position:absolute;right:2px;top:2px;width:44px;height:44px;font-size:22px;color:var(--muted);z-index:1}.reading-celebration-rate{grid-column:2;justify-self:start;min-height:44px;border-radius:9px;background:var(--accent-soft);color:var(--accent);padding:8px 14px;font-weight:600;font-size:12px}
.reading-celebration-confetti{position:absolute;inset:0;pointer-events:none;overflow:hidden}.reading-celebration-confetti i{position:absolute;left:calc(var(--piece)*6.5%);top:-12px;width:6px;height:9px;background:#eab952;animation:reading-confetti 1.5s ease-out both;animation-delay:calc(var(--piece)*25ms)}.reading-celebration-confetti i:nth-child(3n){background:#8c73d9}.reading-celebration-confetti i:nth-child(3n + 1){background:#63ba9a}
@keyframes reading-confetti{to{transform:translateY(230px) rotate(280deg);opacity:0}}@keyframes reading-celebration-in{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.reading-celebration{animation:none}.reading-celebration-confetti{display:none}}

:root .reading-celebration .reading-celebration-art .cover-art,:root #bookDialog .reading-celebration .reading-celebration-art .cover-art{width:42px;height:60px;max-width:42px;min-height:0;margin:0;padding:0;font-size:10px}

.book-finished-dialog{box-sizing:border-box;width:min(500px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow-y:auto;overflow-x:hidden;margin:auto;padding:24px;border:1px solid var(--line);border-radius:24px;background:var(--surface,var(--paper));color:var(--ink);text-align:center;box-shadow:0 24px 90px #15243850}
.book-finished-dialog::backdrop{background:#14243b88;backdrop-filter:blur(5px)}
.finished-close{position:absolute;top:6px;right:6px;width:44px;height:44px;font-size:26px;color:var(--muted);z-index:2}.finished-kicker{font-size:9px;letter-spacing:1.5px;color:var(--accent);font-weight:600}.book-finished-dialog h2{font-size:27px;line-height:1.2;margin:8px 20px 16px;letter-spacing:-.6px}
.finished-cover{position:relative;display:grid;place-items:center;margin:0 auto 14px;width:150px;max-width:42%;height:200px;border-radius:8px;box-shadow:0 10px 26px #10244030;overflow:hidden}.finished-cover .cover-art{position:relative!important;width:100%!important;height:100%!important;max-width:none!important;margin:0!important;aspect-ratio:3/4;font-size:18px}.finished-cover img{width:100%;height:100%;object-fit:cover}
.book-finished-dialog .finished-title{font-size:20px;line-height:1.3;margin:4px 0;overflow-wrap:anywhere}.finished-author{font-size:12px;color:var(--muted);margin:4px 0 8px}
.finished-stars{display:flex;justify-content:center;gap:4px}.finished-stars button{font-size:36px;line-height:1;min-width:44px;min-height:48px;padding:2px;color:var(--muted);border-radius:8px}.finished-stars button[aria-pressed="true"]{color:#e8ad19;text-shadow:0 1px 2px #80630020}.finished-stars button:hover{background:var(--accent-soft)}.finished-rating-label{font-size:11px;color:var(--muted)}
.finished-message{font-size:14px;line-height:1.5;margin:12px auto;max-width:360px;font-weight:600;overflow-wrap:anywhere}.finished-dates{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;text-align:left}.finished-dates label{display:flex;flex-direction:column;gap:6px;min-width:0;font-size:12px;font-weight:600}.finished-dates input{box-sizing:border-box;min-width:0;width:100%;min-height:42px;padding:8px;border:1px solid var(--line);border-radius:9px;background:var(--paper);color:var(--ink);font:inherit}
.finished-help,.finished-save-status{font-size:11px;line-height:1.5;margin:10px 0;color:var(--muted)}.finished-error{padding:10px;border:1px solid #d66;border-radius:8px;background:#fff0f0;color:#9a2020;font-size:13px;font-weight:600;line-height:1.4}.finished-error:empty{display:none}.finished-done{min-height:44px;padding:10px 24px;border-radius:10px;background:var(--accent);color:white;font-size:13px;font-weight:600;width:100%}
.finished-fireworks{position:absolute;inset:0;pointer-events:none;overflow:hidden;border-radius:24px}.finished-fireworks i{position:absolute;left:50%;top:28%;width:7px;height:10px;background:#e8ad19;border-radius:2px;animation:finished-burst 1.6s cubic-bezier(.13,.7,.2,1) both;animation-delay:var(--delay)}.finished-fireworks i:nth-child(3n){background:#ac7de0}.finished-fireworks i:nth-child(3n + 1){background:#64c5ac}
@keyframes finished-burst{0%{transform:translate(0,0) scale(.2);opacity:0}8%{opacity:1}100%{transform:translate(var(--x),var(--y)) rotate(var(--turn));opacity:0}}
html[data-app-theme="dark"] .finished-error{background:#42262c;color:#ffc4c4;border-color:#a95c68}
@media(max-height:740px){.book-finished-dialog{padding:16px}.book-finished-dialog h2{font-size:23px;margin:5px 20px 10px}.finished-cover{width:105px;height:140px;margin-bottom:8px}.book-finished-dialog .finished-title{font-size:18px}.finished-message{margin:8px auto;font-size:13px}.finished-help,.finished-save-status{margin:6px 0}}
@media(prefers-reduced-motion:reduce){.finished-fireworks{display:none}.finished-fireworks i{animation:none}}

.finished-author{overflow-wrap:anywhere}.book-finished-dialog .finished-cover .cover-art{line-height:1.5}

/* Keep routine cloud confirmations quiet; retain pending, offline and error feedback. */
:root #bookDialog #bookCloudSaveStatus[data-state="saved"]{display:none}

:root #bookDialog .book-save-information{flex-basis:100%;width:100%}:root #bookDialog .book-save-hint{max-width:none;width:100%}

:root #bookDialog #bookStartReread{min-height:44px;border:1px solid var(--book-border);border-radius:10px;background:var(--accent-soft);color:var(--book-action,var(--accent));padding:10px 14px;font-weight:600;margin:0 0 10px}#bookStartReread:disabled{opacity:.65;cursor:default}

:root #bookDialog .book-remove-read{min-height:44px;padding:8px 0;color:var(--book-action,var(--accent));font-size:12px;text-decoration:underline;text-underline-offset:3px}

:root #bookDialog .book-reread-help{font-size:12px;line-height:1.5;color:var(--book-muted);margin:0 0 12px}

#readingTimerDialog .reading-timer-browse-note{font-size:12px;line-height:1.6;text-align:center;margin:12px 0 16px;padding:10px 12px;border-radius:12px;background:#edf3ff;color:#48668c}html[data-app-theme=dark] #readingTimerDialog .reading-timer-browse-note{background:#253650;color:#c1d4ef}
