/*
  📖 NovelBoy's pages: 📚 the shelf and a book (novel-books.js: nb-*), ✍️ the writing page (novel-write.js: nw-*),
  🗺️ the plan (novel-plan.js: np-*), ⬇️ share (novel-share.js: ns-*) and 🖨️ print (#nb-print). Tokens only (theme.css:
  the app's, and the book's --paper*, --book-font, --cover-*); no colour of its own. Phone first, from 320 px.
  (The reader, the book in pages, has its own: novel-read.css.)
*/
.nb-page { max-width: 920px; margin: 0 auto; }
.link-like { appearance: none; background: none; border: 0; padding: 0; font: inherit; color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link-like:hover { color: var(--accent); }
.chip.small { font-size: .72rem; padding: .1rem .45rem; }

/* 🎯 the goal ring: --p is how far (0-100) */
.nb-ring { --p: 0; flex: 0 0 auto; width: 1.35rem; height: 1.35rem; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--sunken) 0); position: relative; }
.nb-ring::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--surface); }
.nb-ring.met { background: var(--good); }
.nb-ring.met::after { content: '✓'; display: grid; place-items: center; font-size: .7rem; font-weight: 800; color: var(--good); }
.nb-goal { display: flex; align-items: center; gap: .55rem; margin: .35rem 0; font-weight: 600; }
.nb-goal.big { font-size: 1.05rem; }
.nb-goal.big .nb-ring { width: 1.8rem; height: 1.8rem; }
.nb-pass { margin: .2rem 0; font-size: .88rem; color: var(--accent-text); font-weight: 600; }

/* 📕 a cover: a coloured book with its emoji and title */
.nb-cover { --cover: var(--cover-violet); display: flex; flex-direction: column; justify-content: space-between; align-items: center; aspect-ratio: 2 / 3; border-radius: 4px 10px 10px 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--cover) 70%, var(--cover-shade)) 0 7%, var(--cover) 9%); color: var(--cover-ink); box-shadow: var(--shadow-md); padding: .6rem .45rem; text-align: center; overflow: hidden; flex: 0 0 auto; }
.nb-cover.small { width: 4.6rem; font-size: .62rem; }
.nb-cover.big { width: 8.5rem; font-size: .9rem; }
.nb-cover-emoji { font-size: 1.9em; line-height: 1; margin-top: .3em; }
/* 🖼️ a cover picture fills the book (novel-books.js coverHtml) */
.nb-cover.has-img { padding: 0; }
.nb-cover.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nb-cover-title { font-family: var(--book-font); font-weight: 700; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* 📚 the shelf and Home's today */
.nb-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.nb-card { display: flex; gap: .9rem; align-items: flex-start; margin: 0 !important; }
.nb-card-open { appearance: none; border: 0; background: none; padding: 0; cursor: pointer; }
.nb-card-body { flex: 1 1 auto; min-width: 0; }
.nb-card-body h3 { font-size: 1.05rem; }
.nb-card-body h3 .link-like { color: var(--text); text-decoration: none; font-weight: 700; text-align: left; }
.nb-card-body p { margin: .25rem 0; }
.nb-home-today { margin: 1rem 0 1.25rem; }

/* 📖 one book */
.nb-book-head { display: flex; gap: 1.25rem; align-items: flex-start; margin-bottom: 1rem; }
.nb-book-head h2 { font-family: var(--book-font); font-size: 1.7rem; }
.nb-premise { font-family: var(--book-font); font-style: italic; margin: 0; color: var(--text-2); }
@media (max-width: 560px) { .nb-book-head { flex-direction: column; align-items: center; text-align: center; } .nb-book-head .btn-row { justify-content: center; } .nb-cover.big { width: 7rem; } }
.nb-today h3, .nb-page section h3 { margin: 0; }
.nb-pass-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .5rem .65rem; margin: .4rem 0; border-radius: var(--radius); background: var(--accent-soft); font-weight: 600; }
.nb-bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; align-items: end; height: 76px; margin-top: .8rem; }
.nb-bar { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; height: 100%; gap: 3px; }
.nb-bar i { display: block; min-height: 3px; border-radius: 4px 4px 2px 2px; background: color-mix(in srgb, var(--accent) 45%, var(--sunken)); }
.nb-bar.met i { background: var(--accent); }
.nb-bar.off i { background: var(--sunken); }
.nb-bar b { font-size: .65rem; text-align: center; color: var(--text-3); font-weight: 600; }
.nb-bar.today b { color: var(--accent-text); }
.nb-chapters { list-style: none; margin: .75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.nb-ch { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem .5rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.nb-ch.current { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.nb-ch.planned { border-style: dashed; background: var(--surface-2); }
.nb-ch.done .nb-ch-n { background: var(--good-soft); color: var(--good); }
.nb-ch-n { flex: 0 0 auto; width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); font-weight: 700; font-size: .85rem; color: var(--text-2); }
.nb-ch-name { margin: 0; }
.nb-ch-art { flex: 0 0 auto; width: 4.5rem; height: 2.8rem; object-fit: cover; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
@media (max-width: 520px) { .nb-ch-art { width: 3.2rem; height: 2.2rem; } }
/* 🖼️ 🎨 a box's picture part (novel-books.js artPartHtml): the preview, 📷 Choose a picture…, Remove */
.nb-art-part { border-top: 1px solid var(--border); padding-top: .65rem; }
.nb-art-label { margin: 0 0 .45rem; font-size: .88rem; color: var(--text-2); }
.nb-art-label .hint { font-weight: 400; color: var(--text-3); font-size: .8rem; }
.nb-art-prev img { display: block; object-fit: cover; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.nb-art-prev.cover img { width: 4rem; height: 6rem; }
.nb-art-prev.chapter img { width: 8rem; height: 5rem; }
.nb-art-pick { position: relative; cursor: pointer; }
.nb-art-pick:focus-within { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; }
.nb-ch-sum { margin: .2rem 0 0; font-size: .9rem; color: var(--text-2); }

/* the boxes */
.nb-form fieldset { border: 0; padding: 0; margin: 0; }
.nb-form legend { font-weight: 600; font-size: .88rem; color: var(--text-2); margin-bottom: .35rem; }
.nb-covers { display: flex; gap: .45rem; flex-wrap: wrap; }
.nb-swatch { --cover: var(--cover-violet); position: relative; width: 2rem; height: 2.6rem; border-radius: 3px 7px 7px 3px; background: var(--cover); cursor: pointer; box-shadow: var(--shadow-sm); }
.nb-swatch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.nb-swatch:has(input:checked) { outline: 3px solid var(--accent); outline-offset: 2px; }
.nb-swatch:has(input:focus-visible) { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.nb-goal-edit { font-weight: 600; }
.nb-goal-edit input, .nb-num { width: 5.5rem; }
.nb-wd { display: flex; gap: .35rem; flex-wrap: wrap; padding-left: 1.6rem; }
.nb-wd-chip { position: relative; }
.nb-wd-chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.nb-wd-chip span { display: inline-block; min-width: 2.8rem; text-align: center; padding: .35rem .5rem; border-radius: 999px; border: 1px solid var(--border-strong); font-weight: 600; font-size: .85rem; }
.nb-wd-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.nb-wd-chip input:focus-visible + span { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.nb-pass-edit { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; padding: .45rem .5rem; border: 1px solid var(--border); border-radius: var(--radius); }
/* (each <select> is drawn as a .bsel-btn: select.js; here they sit side by side, as wide as their words) */
.nb-pass-edit select, .nb-pass-edit .bsel-btn, .nb-goal-edit .bsel-btn, .nb-form .check .bsel-btn { width: auto; flex: 0 0 auto; }
/* (a number or a day inside a check line: app.css sizes .check's inputs as ticks) */
.nb-form .check input[type=number] { width: 4.5rem; height: auto; flex: 0 0 auto; }
.nb-form .check input[type=date] { width: auto; height: auto; flex: 0 0 auto; }
.nb-form .check { flex-wrap: wrap; }
.nb-pub h4 { margin: 0; font-size: .95rem; }
.nb-pub p, .nb-pub ul { margin: .35rem 0 .8rem; }
.nb-pre { white-space: pre-wrap; }
.nb-notes, .nw-notes, .nw-next { margin: .3rem 0; padding-left: 1.2rem; }
.nb-notes li, .nw-notes li, .nw-next li { margin: .3rem 0; }
.nw-notes { list-style: none; padding-left: 0; }
.nb-fixes, .nw-fixes, .nw-swaps { margin: .5rem 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .55rem; }
.nw-swaps { list-style: none; padding-left: 0; }
.nb-fixes li p, .nw-fixes li p, .nw-swaps li p { margin: 0 0 .2rem; }
.nb-fixes li.applied, .nw-fixes li.applied, .nw-swaps li.applied { opacity: .6; }
del { color: var(--bad-text); text-decoration-thickness: 2px; }
ins { color: var(--good); text-decoration: none; font-weight: 600; }

/* ✍️ the writing page */
.nw-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.nw-progress { margin: .2rem 0 .8rem; }
.nw-ahead { color: var(--text-3); font-weight: 500; }
.nw-guide { margin-bottom: .9rem; }
.nw-art { display: block; width: 100%; max-height: 12rem; object-fit: cover; border-radius: var(--radius); margin: 0 0 .7rem; }
.nw-chapter-pick select { font-weight: 700; max-width: 100%; }
.nw-kicker { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); margin-bottom: .15rem; }
.nw-summary { margin: .7rem 0 .2rem; font-family: var(--book-font); font-size: 1.05rem; line-height: 1.45; }
.nw-summary.muted { font-family: inherit; font-size: .9rem; }
.nw-nudge { margin: .5rem 0 0; padding: .5rem .7rem; border-radius: var(--radius); background: var(--warn-soft); font-size: .9rem; }
.nw-next-ch { margin: .5rem 0 0; }
.nw-context { margin-bottom: .9rem; }
.nw-page { background: var(--paper); color: var(--paper-ink); font-family: var(--book-font); font-size: 1.02rem; line-height: 1.6; padding: 1rem 1.25rem; border-radius: 3px 6px 6px 3px; box-shadow: var(--paper-shadow); border-left: 6px solid var(--paper-edge); max-height: 22rem; overflow: auto; margin-top: .35rem; }
.nw-page p { margin: 0; text-indent: 1.4em; text-align: justify; hyphens: auto; }
.nw-page p:first-child, .nw-page .nw-break + p, .nw-page h4 + p, .nw-page .nw-ctx-note + p { text-indent: 0; }
.nw-page .nw-break { text-align: center; text-indent: 0; margin: .6rem 0; color: var(--paper-ink-2); }
.nw-ctx-h { text-align: center; font-size: 1.15rem; margin: .2rem 0 .8rem; }
.nw-ctx-note { font-size: .8rem; text-indent: 0 !important; color: var(--paper-ink-2); font-family: var(--font); margin-bottom: .5rem !important; }
.nw-first { font-style: italic; color: var(--paper-ink-2); text-indent: 0 !important; text-align: left !important; }
.nw-write { display: flex; flex-direction: column; gap: .55rem; }
.nw-editor { min-height: 14rem; font-family: var(--book-font); font-size: 1.08rem; line-height: 1.65; padding: 1rem 1.1rem; background: var(--paper); color: var(--paper-ink); border-color: var(--paper-edge); }
.nw-editor::placeholder { color: var(--paper-ink-2); font-style: italic; }
/* (padding-right: the round 💬 Help button sits over the bar's right end: help.css .help-fab) */
.nw-bar { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; position: sticky; bottom: 0; padding: .45rem 7.5rem .45rem 0; background: color-mix(in srgb, var(--bg) 92%, transparent); }
.nw-ai-hint { margin: -.2rem 0 0; }
.nw-ai-out { margin-top: .2rem; }
.nw-ai-out .row b { font-size: 1rem; }
.nw-syn { margin: .4rem 0; }
.nw-syn-notes { margin: .3rem 0; padding-left: 1.1rem; }

/* 🗺️ the plan */
.np h2 { margin: .3rem 0 .4rem; }
.np-parts textarea { font-family: var(--book-font); font-size: 1rem; }
.np-outline { margin-top: 1rem; }
.np-list, .np-pv-list { list-style: none; padding: 0; margin: .75rem 0; display: flex; flex-direction: column; gap: .6rem; }
.np-row, .np-pv { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.np-row.current { border-color: var(--accent); }
.np-row.planned { border-style: dashed; }
.np-row textarea, .np-pv textarea { font-size: .92rem; }
.np-moves { display: flex; flex-direction: column; gap: .2rem; }
@media (max-width: 520px) { .np-moves { flex-direction: row; } .np-row { flex-wrap: wrap; } }

/* ⬇️ share */
.ns h2 { margin: .3rem 0 .3rem; }
.ns-which { border: 0; padding: 0; margin: .6rem 0 1rem; gap: 1.2rem; }
.ns-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.ns-card { margin: 0 !important; display: flex; flex-direction: column; gap: .4rem; }
.ns-card p { margin: 0; flex: 1 1 auto; }

/* 🖨️ print: only the book (novel-share.js print(): #nb-print, body.nb-printing), a 6 × 9 inch page */
.nb-print { display: none; }
@media print {
  @page { size: 6in 9in; margin: .75in .7in .8in; }
  body.nb-printing > *:not(#nb-print) { display: none !important; }
  body.nb-printing { background: none; }
  body.nb-printing #nb-print { display: block; color: var(--print-ink); font-family: var(--book-font); font-size: 11pt; line-height: 1.45; }
  #nb-print .nb-print-cover { break-after: page; height: 7.4in; display: flex; align-items: center; justify-content: center; }
  #nb-print .nb-print-cover img { max-width: 100%; max-height: 100%; object-fit: contain; }
  #nb-print .nb-print-art { margin: 0 0 .25in; text-align: center; }
  #nb-print .nb-print-art img { max-width: 100%; max-height: 2.6in; object-fit: cover; }
  #nb-print .nb-print-art + h2 { margin-top: .3in; }
  #nb-print .nb-print-title { text-align: center; padding-top: 2.4in; break-after: page; }
  #nb-print .nb-print-title h1 { font-size: 24pt; margin: 0 0 .2in; }
  #nb-print .nb-print-subtitle { font-style: italic; font-size: 13pt; margin: 0 0 .5in; }
  #nb-print .nb-print-chapter { break-before: page; }
  #nb-print .nb-print-chapter h2 { text-align: center; font-size: 16pt; margin: 1.6in 0 .35in; }
  #nb-print p { margin: 0; text-indent: 1.5em; text-align: justify; hyphens: auto; orphans: 2; widows: 2; }
  #nb-print h2 + p, #nb-print .nb-break + p { text-indent: 0; }
  #nb-print .nb-break { text-align: center; text-indent: 0; margin: .12in 0; }
}
