:root {
  color-scheme:light;
  --paper:#f8f7f4;
  --ink:#30332f;
  --muted:#777b73;
  --line:#dedfd7;
  --accent:#686f52;
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif
}
* {
  box-sizing:border-box
}
body {
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--font);
  font-size:15px;
  -webkit-font-smoothing:antialiased
}
button,input,textarea {
  font:inherit
}
button,a,input,textarea {
  -webkit-tap-highlight-color:transparent
}
button {
  color:inherit;
  background:none;
  border:0;
  cursor:pointer
}
button:disabled {
  opacity:.28;
  cursor:default
}
button:not(:disabled):hover {
  color:var(--accent)
}
a {
  color:inherit;
  text-decoration:none
}
button:focus-visible,a:focus-visible {
  outline:1px solid var(--accent);
  outline-offset:2px
}
/* Disclosure rows keep keyboard focus visible without enclosing the text. */
summary:focus-visible {
  outline:none;
  box-shadow:inset 0 -1px 0 var(--accent)
}
input:focus-visible,textarea:focus-visible {
  outline:1px solid var(--accent);
  outline-offset:3px
}
[hidden] {
  display:none!important
}
.book-header {
  min-height:111px; margin:0 6%; display:grid; grid-template-columns:1fr auto 1fr;
  align-items:center; gap:16px; border-bottom:1px solid var(--line);
}
.book-name { text-align:center; font-size:18px; font-weight:600; letter-spacing:-.55px; max-width:38vw; overflow-wrap:anywhere; }
.brand-title { display:inline-flex; align-items:center; justify-content:center; gap:10px; }
.brand-logo { display:block; width:38px; height:auto; flex:0 0 38px; object-fit:contain; mix-blend-mode:darken; }
.header-actions { display:flex; align-items:center; justify-self:end; gap:22px; }
.book-header .account-link { color:var(--muted); font-size:12px; padding:14px 0; }
.private-label {
  display:block;
  font-size:11px;
  letter-spacing:.15px;
  font-weight:400;
  color:var(--muted);
  margin-top:6px
}
.add-button {
  font-size:13px;
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 0 10px 12px
}
.add-button>span:first-child {
  font-size:23px;
  font-weight:300;
  line-height:1
}
.pending-dot {
  width:5px;
  height:5px;
  background:var(--accent);
  border-radius:50%
}
.book {
  max-width:696px;
  margin:0 auto;
  padding:0 24px
}
.book-nav {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:35px;
  font-size:12px;
  color:var(--muted)
}
.quiet-button {
  padding:8px 0
}
.quiet-button span {
  font-size:19px;
  vertical-align:-1px;
  margin-right:6px
}
.reading-page {
  padding-top:66px;
  min-height:580px
}
.entry-prelude {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  color:var(--muted);
  font-size:11px;
  letter-spacing:.2px
}
.reader-topics {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px
}
.reader-topics button {
  padding:0
}
.reader-topics button+button:before {
  content:"/";
  color:#a9ac9f;
  margin-right:8px
}
.entry-prelude>span {
  white-space:nowrap
}
h1 {
  font-size:39px;
  line-height:1.15;
  letter-spacing:-1.65px;
  font-weight:500;
  margin:22px 0 24px;
  text-wrap:balance
}
h1:focus {
  outline:none
}
.reader-key {
  font-size:19px;
  line-height:1.6;
  letter-spacing:-.25px;
  margin:0 0 32px;
  font-weight:500
}
.reader-body {
  font-size:16px;
  line-height:1.85;
  letter-spacing:-.1px
}
.reader-body p {
  margin:0 0 24px
}
.reader-date {
  margin:30px 0 0;
  color:var(--muted);
  font-size:12px;
  line-height:1.6;
  letter-spacing:.15px
}
.draft-note {
  font-size:11px;
  color:var(--muted);
  line-height:1.6;
  margin:39px 0 0;
  max-width:480px
}
.draft-note:before {
  content:"○";
  margin-right:6px
}
.reading-footer {
  border-top:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-top:32px;
  padding-top:12px;
  gap:16px;
  font-size:12px;
  color:var(--muted);
  font-variant-numeric:tabular-nums
}
.reader-navigation { display:flex; align-items:center; gap:16px; }
#page-position { white-space:nowrap; }
.page-controls { display:flex; gap:4px; }
.page-controls button {
  display:inline-flex; align-items:center; justify-content:center;
  width:44px; height:44px; padding:10px; border-radius:10px;
}
.page-controls button:not(:disabled):hover { background:#686f5210; }
.page-controls svg { flex-shrink:0; }
.book-colophon {
  display:flex;
  justify-content:space-between;
  margin:69px 0 32px;
  color:var(--muted);
  font-size:10px;
  letter-spacing:.2px
}
.colophon-mark {
  font-size:20px;
  line-height:12px;
  color:var(--accent)
}
.related { margin:38px 0 0; color:var(--muted); font-size:12px; }
.related > summary { display:flex; align-items:center; gap:14px; width:fit-content; min-height:44px; list-style:none; cursor:pointer; border-radius:8px; }
.related > summary::-webkit-details-marker { display:none; }
.related > summary span { display:inline-block; transition:transform .16s ease; }
.related[open] > summary span { transform:rotate(180deg); }
.related > summary:hover { color:var(--accent); }
.related button { display:block; text-align:left; font-size:12px; color:var(--muted); padding:12px 0; min-height:44px; }
.related button::after { content:' ↗'; margin-left:6px; color:var(--muted); }
#related-links, #entry-connection-list { padding:3px 0 8px 18px; border-left:1px solid var(--line); margin-top:8px; }
#contents {
  padding-top:53px;
  min-height:630px
}
.contents-heading {
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:20px
}
.contents-heading h1 {
  font-size:33px;
  margin:0 0 30px;
  letter-spacing:-1.2px
}
.contents-heading>span {
  font-size:11px;
  white-space:nowrap;
  color:var(--muted)
}
.search-line {
  display:flex;
  align-items:center;
  gap:12px;
  border-bottom:1px solid var(--line);
  padding:12px 0;
  color:var(--muted)
}
.search-line input {
  width:100%;
  border:0;
  background:none;
  color:var(--ink);
  padding:5px 0;
  font-size:14px;
  min-width:0
}
.search-line input:focus-visible {
  outline:none
}
.search-line:focus-within {
  border-bottom-color:var(--accent)
}
input::placeholder,textarea::placeholder {
  color:#96988f
}
/* Keep the native search-clear action, using the app palette instead of system blue. */
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance:none;
  width:16px;
  height:16px;
  margin-left:10px;
  cursor:pointer;
  background-color:var(--muted);
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 5 10 10M15 5 5 15' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 5 10 10M15 5 5 15' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
input[type="search"]::-webkit-search-cancel-button:hover {
  background-color:var(--accent);
}
.search-line kbd {
  font:10px var(--font);
  white-space:nowrap
}
.entry-row {
  display:grid;
  grid-template-columns:28px 1fr 16px;
  gap:15px;
  width:100%;
  padding:23px 0;
  border-bottom:1px solid var(--line);
  text-align:left
}
.entry-number {
  font-size:10px;
  color:var(--muted);
  padding-top:5px;
  font-variant-numeric:tabular-nums
}
.entry-meta {
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  gap:5px 16px;
  color:var(--muted);
  font-size:10px;
  line-height:1.6;
  margin-top:12px
}
.entry-created {
  white-space:nowrap;
  font-variant-numeric:tabular-nums
}
.entry-arrow {
  color:var(--muted);
  font-size:17px
}
.empty-state {
  font-size:14px;
  line-height:1.7;
  color:var(--muted);
  margin-top:40px
}
.app-feedback {
  color:#9c503b;
  font-size:12px;
  line-height:1.6;
  margin-top:30px
}
@media(min-width:1400px) {
  .book-header {
    margin:0 auto;
    max-width:1240px
  }
  .book {
    max-width:728px
  }
  .reading-page {
    padding-top:80px
  }
  .reader-body {
    font-size:17px
  }
}
@media(max-width:600px) {
  .book-header {
    height:90px;
    margin:0 23px
  }
  .book-name {
    font-size:16px
  }
  .private-label {
    font-size:9px
  }
  .add-button {
    font-size:0;
    gap:0;
    padding:12px
  }
  .add-button>span:first-child {
    font-size:27px
  }
  .book {
    padding:0 25px
  }
  .book-nav {
    margin-top:24px;
    font-size:11px
  }
  .quiet-button span {
    margin-right:2px
  }
  .reading-page {
    padding-top:43px;
    min-height:0
  }
  .entry-prelude {
    font-size:10px
  }
  h1 {
    font-size:33px;
    letter-spacing:-1.3px;
    margin:21px 0
  }
  .reader-key {
    font-size:17px;
    line-height:1.65;
    margin-bottom:29px
  }
  .reader-body {
    font-size:15px;
    line-height:1.85
  }
  .draft-note {
    font-size:10px;
    margin-top:31px
  }
  .reading-footer {
    margin-top:28px
  }
  .book-colophon {
    margin-top:45px;
    font-size:9px
  }
  #contents {
    padding-top:43px;
    min-height:570px
  }
  .contents-heading h1 {
    font-size:28px
  }
  .contents-heading>span {
    font-size:10px
  }
  .entry-row {
    grid-template-columns:20px 1fr 12px;
    gap:10px
  }
  .search-line kbd {
    display:none
  }
  dialog {
    padding:22px 24px
  }
}
@media(prefers-reduced-motion:no-preference) {
  .reading-page {
    animation:appear .25s ease
  }
  @keyframes appear {
    from {
      opacity:.3;
      transform:translateY(4px)
    }
    to {
      opacity:1;
      transform:none
    }
  }
}
@media(max-width:600px) {
  .page-controls button {
    min-width:44px
  }
  .search-line input,form input[type="url"],textarea {
    font-size:16px
  }
  .reader-topics button {
    min-height:28px
  }
  .close-button {
    min-width:44px;
    min-height:44px
  }
  .book-nav {
    margin-top:15px
  }
}
.contents-open { display:inline-flex; justify-self:start; align-items:center; gap:9px; min-height:44px; font-size:12px; color:var(--muted); padding:10px 0; }
.contents-open svg { flex-shrink:0; }
.contents-open > span { font-size:inherit; line-height:1; }
.book-nav {
  justify-content:flex-end;
}
.back-to-reading {
  margin-right:auto;
  padding:10px 0;
  font-size:12px;
}
.contents-heading h1 {
  max-width:470px;
}
.contents-context {
  margin:22px 0;
}
.contents-context:empty {
  margin:28px 0 0;
}
.topic-back {
  padding:5px 0;
  font-size:12px;
  color:var(--muted);
}
.entry-content {
  display:block;
  min-width:0;
}
.entry-title {
  display:block;
  font-size:18px;
  letter-spacing:-.4px;
  font-weight:500;
  margin:0 0 8px;
}
.entry-excerpt {
  display:block;
  font-size:13px;
  color:var(--muted);
  line-height:1.6;
}
.chapter {
  border-bottom:1px solid var(--line);
}
.chapter > summary {
  list-style:none;
  display:flex;
  gap:14px;
  align-items:center;
  padding:25px 0;
}
.chapter > summary::-webkit-details-marker {
  display:none;
}
.chapter-name {
  font-size:21px;
  letter-spacing:-.5px;
}
.chapter-chevron {
  color:var(--muted);
  font-size:22px;
  width:10px;
  display:inline-block;
  line-height:1;
}
.chapter[open] > summary .chapter-chevron {
  transform:rotate(90deg);
}
.chapter-count {
  margin-left:auto;
  color:var(--muted);
  font-size:11px;
  font-variant-numeric:tabular-nums;
}
.chapter-entries {
  padding-left:24px;
}
.chapter .entry-row {
  border:0;
  padding:8px 0 28px;
}
.chapter .entry-title {
  font-size:16px;
}
.entry-image {
  width:fit-content;
  max-width:100%;
  margin:28px auto;
}
.entry-image img {
  width:auto;
  height:auto;
  max-width:min(100%, 420px);
  max-height:320px;
  max-height:min(320px, 45svh);
  object-fit:contain;
  display:block;
  margin-inline:auto;
  border-radius:10px;
}
.entry-image figcaption {
  max-width:420px;
  overflow-wrap:anywhere;
  font-size:12px;
  color:var(--muted);
  margin-top:10px;
}
.visually-hidden {
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip-path:inset(50%);
  white-space:nowrap;
}
/* A quiet writing sheet, shared by both ways of adding an entry. */
dialog {
  width:560px;
  max-width:calc(100vw - 32px);
  max-height:calc(100dvh - 48px);
  padding:32px 38px;
  overflow:auto;
  border:1px solid #ffffff90;
  border-radius:24px;
  background:var(--paper);
  color:var(--ink);
  box-shadow:0 30px 100px #25282026;
  scrollbar-width:thin;
}
dialog.writing {
  width:680px;
}
dialog::backdrop {
  background:#34393035;
  backdrop-filter:blur(7px);
}
.dialog-top {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom:24px;
}
.close-button {
  display:grid;
  place-items:center;
  font-size:25px;
  width:32px;
  height:32px;
  border-radius:50%;
  font-weight:300;
}
.close-button:hover {
  background:#eaece4;
}
dialog h2 {
  font-size:31px;
  font-weight:500;
  letter-spacing:-1px;
  margin:0;
}
.compose-modes {
  display:flex;
  gap:4px;
  border-radius:13px;
  padding:4px;
  background:#eaece480;
}
.compose-modes button {
  flex:1;
  font-size:12px;
  padding:12px 8px;
  border-radius:10px;
  color:var(--muted);
}
.compose-modes [aria-pressed="true"] {
  background:var(--paper);
  color:var(--ink);
  box-shadow:0 1px 5px #30332f0b;
}
form label {
  display:block;
  font-size:12px;
  margin:20px 0 9px;
}
form label > span {
  color:var(--muted);
  font-size:10px;
  margin-left:6px;
}
form input:not([type="checkbox"]):not([type="file"]):not([type="radio"]), textarea {
  width:100%;
  border:1px solid var(--line);
  border-radius:11px;
  background:#ffffff50;
  padding:13px 14px;
  color:var(--ink);
  font-size:14px;
}
textarea {
  resize:vertical;
  min-height:78px;
  line-height:1.7;
}
form input:focus-visible, textarea:focus-visible {
  outline:1px solid #929b7c;
  outline-offset:2px;
}
.form-actions {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-top:22px;
  gap:16px;
}
.file-button {
  font-size:12px;
  padding:8px 0;
}
.submit-button {
  background:var(--ink);
  color:var(--paper);
  font-size:12px;
  padding:13px 18px;
  border-radius:12px;
}
.submit-button:not(:disabled):hover {
  background:var(--accent);
  color:var(--paper);
}
.submit-button > span {
  margin-left:10px;
}
#import-form .submit-button {
  min-height:48px;
  padding:13px 21px;
  border-radius:14px;
  background:var(--accent);
  font-size:13px;
  font-weight:500;
}
#import-form .submit-button:not(:disabled):hover {
  background:color-mix(in srgb,var(--accent) 88%,var(--ink));
}
#import-form .submit-button:not(:disabled):active {
  background:color-mix(in srgb,var(--accent) 78%,var(--ink));
}
.import-feedback, .setup-note {
  font-size:11px;
  line-height:1.7;
  color:var(--muted);
}
.import-feedback:empty {
  display:none;
}
.import-feedback.error, .job-error {
  color:#9c503b;
}
.setup-note {
  margin-top:22px;
}
#inbox {
  border-top:1px solid var(--line);
  margin-top:26px;
  padding-top:18px;
}
summary {
  cursor:pointer;
  font-size:12px;
}
#job-count {
  color:var(--muted);
  margin-left:8px;
}
.job {
  padding:16px 0;
  border-bottom:1px solid var(--line);
  font-size:12px;
  overflow-wrap:anywhere;
}
.job-status, .job-error {
  font-size:11px;
  margin-top:7px;
  line-height:1.6;
}
.job-status, .muted {
  color:var(--muted);
}
.muted {
  font-size:12px;
  line-height:1.6;
}
#manual-title {
  font-weight:500;
  letter-spacing:-.7px;
  margin-top:24px;
  padding:10px 0 15px;
  font-size:24px;
  border:0;
  border-radius:0;
  border-bottom:1px solid var(--line);
  background:none;
}
textarea.writing-body {
  margin-top:20px;
  padding:14px;
  font-size:15px;
  line-height:1.85;
  min-height:185px;
}
.topic-suggestions {
  display:flex;
  flex-wrap:wrap;
  gap:8px 16px;
  margin-top:7px;
}
.topic-suggestions button {
  color:var(--muted);
  font-size:12px;
  padding:5px 0;
  text-align:left;
}
.attachment-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-top:21px;
}
.attachment-heading .file-button {
  font-size:12px;
  text-align:left;
}
.attachment-heading > span {
  font-size:10px;
  color:var(--muted);
}
.image-preview {
  display:flex;
  align-items:center;
  gap:12px;
  margin:12px 0;
}
.image-preview img {
  width:68px;
  height:68px;
  object-fit:cover;
  border-radius:10px;
}
.image-preview input {
  min-width:0;
}
.remove-image {
  flex-shrink:0;
  font-size:22px;
  padding:10px;
}
.review-controls {
  border-top:1px solid var(--line);
  padding-top:20px;
  margin-top:22px;
}
.check-label {
  display:flex;
  align-items:flex-start;
  gap:11px;
  margin:0;
  cursor:pointer;
}
.check-label input {
  accent-color:var(--accent);
  width:16px;
  height:16px;
  margin:1px 0 0;
  flex-shrink:0;
}
.check-label > span {
  color:var(--ink);
  font-size:12px;
  margin:0;
}
.check-label small {
  display:block;
  color:var(--muted);
  font-size:10px;
  margin-top:6px;
  line-height:1.6;
}
#review-start {
  margin-top:12px;
  text-decoration:underline;
  text-underline-offset:5px;
}
.review-result {
  margin-top:24px;
  border-top:1px solid var(--line);
  padding-top:16px;
}
.review-result h3 {
  font-weight:500;
  font-size:14px;
}
.review-result h4 {
  font-size:21px;
  font-weight:500;
  margin:23px 0 15px;
}
.review-result p {
  font-size:13px;
  line-height:1.8;
  white-space:pre-wrap;
}
#review-notes, #review-topics {
  color:var(--muted);
  font-size:11px;
}
.manual-footer {
  border-top:1px solid var(--line);
  padding-top:20px;
  margin-top:23px;
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:16px;
}
/* Book-spine detail using the shared notebook palette. */
.save-entry {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  min-height:48px;
  padding:12px 21px 12px 17px;
  border:1px solid var(--accent);
  border-left:3px solid color-mix(in srgb, var(--accent) 78%, var(--ink));
  border-radius:5px 13px 13px 5px;
  background:var(--accent);
  color:var(--paper);
  box-shadow:0 2px 3px color-mix(in srgb, var(--ink) 4%, transparent);
  font-size:13px;
  font-weight:500;
  letter-spacing:-.1px;
}
.save-entry svg {
  width:23px;
  height:23px;
  flex-shrink:0;
  color:var(--paper);
}
.save-entry:not(:disabled):hover {
  background:color-mix(in srgb, var(--accent) 88%, var(--ink));
  border-color:var(--paper);
  color:var(--paper);
}
.save-entry:not(:disabled):active {
  background:color-mix(in srgb, var(--accent) 78%, var(--ink));
  box-shadow:inset 0 1px 3px color-mix(in srgb, var(--ink) 8%, transparent);
}
@media(max-width:600px) {
  .contents-open {
    font-size:11px;
    gap:4px;
    min-height:44px;
  }
  .contents-open > span { font-size:inherit; }
  .book-header .add-button {
    padding:10px 0 10px 12px;
  }
  .contents-heading {
    align-items:flex-start;
    gap:14px;
  }
  .contents-heading > span {
    margin-top:9px;
  }
  .contents-heading h1 {
    font-size:28px;
  }
  .entry-title {
    font-size:17px;
  }
  .entry-excerpt {
    font-size:12px;
  }
  .chapter-name {
    font-size:20px;
  }
  dialog, dialog.writing {
    max-width:calc(100vw - 20px);
    max-height:calc(100dvh - 24px);
    padding:23px 22px;
    border-radius:22px;
  }
  dialog h2 {
    font-size:29px;
    margin:0;
  }
  .close-button {
    min-width:40px;
    min-height:40px;
  }
  .compose-modes button {
    min-height:44px;
    font-size:11px;
  }
  form input:not([type="checkbox"]):not([type="file"]):not([type="radio"]), textarea {
    font-size:16px;
  }
  #manual-title {
    font-size:22px;
  }
  textarea.writing-body {
    font-size:16px;
  }
  .form-actions {
    gap:12px;
  }
  .submit-button {
    padding:13px 14px;
  }
  .file-button {
    min-height:44px;
    font-size:11px;
  }
  .image-preview {
    gap:7px;
  }
  .image-preview img {
    width:50px;
    height:50px;
  }
}
body:has(dialog[open]) {
  overflow:hidden;
}

.reader-tools { display:flex; gap:16px; align-items:center; min-width:0; }
.reader-tools .rewrite-link { min-width:44px; min-height:44px; white-space:nowrap; }
.reader-tools .entry-image-camera { width:44px; height:44px; }
.rewrite-link { font-size:11px; color:var(--muted); padding:8px 0; }
#rewrite-dialog { width:740px; }
#rewrite-dialog h2 { font-size:28px; }
.rewrite-entry-name { color:var(--muted); font-size:13px; margin:0 0 23px; }
#rewrite-fields { border:0; padding:0; margin:0; min-width:0; }
.rewrite-modes { display:flex; flex-wrap:wrap; gap:8px; }
.rewrite-modes label { margin:0; display:flex; align-items:center; gap:7px; border:1px solid var(--line); border-radius:10px; padding:11px 12px; cursor:pointer; }
.rewrite-modes label:has(input:checked) { border-color:var(--accent); background:color-mix(in srgb, var(--accent) 6%, var(--paper)); }
.rewrite-modes input { accent-color:var(--accent); margin:0; }
.rewrite-modes label span { color:var(--ink); margin:0; font-size:12px; }
.rewrite-hint { font-size:11px; color:var(--muted); line-height:1.7; }
.rewrite-source { margin-top:20px; }
.rewrite-preview { margin-top:28px; border-top:1px solid var(--line); padding-top:20px; }
.rewrite-preview-heading { display:flex; justify-content:space-between; align-items:center; }
.rewrite-preview h3 { font-size:17px; font-weight:500; margin:0; }
.rewrite-original { margin:18px 0 26px; padding:14px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.rewrite-text h4, #rewrite-original-text h4 { font-size:24px; font-weight:500; letter-spacing:-.6px; margin:20px 0; }
.rewrite-text p, #rewrite-original-text p { font-size:14px; line-height:1.85; white-space:pre-wrap; }
.rewrite-key { font-weight:500; }
.rewrite-history { border-top:1px solid var(--line); padding-top:18px; margin-top:25px; }
#rewrite-version-count { color:var(--muted); margin-left:7px; }
.saved-version { border-bottom:1px solid var(--line); padding:17px 0; }
.saved-version > summary { font-size:11px; color:var(--muted); }
@media(max-width:600px) {
  #rewrite-dialog h2 { font-size:24px; }
  .rewrite-modes { gap:6px; }
  .rewrite-modes label { padding:10px; }
  .rewrite-modes label span { font-size:11px; }
  #rewrite-dialog .manual-footer { flex-wrap:wrap; }
}

@media(max-width:600px) {
  .book-header { grid-template-columns:1fr auto 1fr; gap:10px; margin:0 20px; min-height:90px; height:auto; }
  .book-name { font-size:16px; max-width:40vw; }
  .private-label { display:none; }
  .header-actions { gap:14px; }
  .book-header .add-button { padding:8px 0; min-width:28px; min-height:44px; }
  .add-label { display:none; }
  .contents-open { gap:6px; }
}
@media(max-width:360px) {
  .book-header { margin:0 14px; gap:6px; }
  .header-actions { gap:10px; }
  .book-name { font-size:14px; }
}
@media(max-width:420px) {
  .book-header { grid-template-columns:1fr 1fr; gap:0 12px; padding:18px 0 9px; }
  .book-name { grid-column:1 / -1; grid-row:1; justify-self:center; max-width:100%; font-size:16px; margin-bottom:6px; }
  .contents-open { grid-column:1; grid-row:2; }
  .header-actions { grid-column:2; grid-row:2; }
}
.cost-group { border-top:1px solid var(--line); font-size:12px; }
.cost-group > summary { display:flex; justify-content:space-between; align-items:center; gap:20px; padding:15px 0; min-height:44px; list-style:none; cursor:pointer; color:var(--muted); }
.cost-group > summary:hover { color:var(--accent); }
.cost-group > summary > span:first-child { min-width:0; overflow-wrap:anywhere; }
.cost-amount { flex-shrink:0; font-variant-numeric:tabular-nums; }
.cost-call { padding:8px 0 18px 16px; border-left:1px solid var(--line); margin-bottom:20px; }
.cost-call-title { font-size:12px; line-height:1.6; margin:0 0 12px; color:var(--ink); }
.cost-line { display:flex; align-items:baseline; justify-content:space-between; gap:20px; font-size:11px; line-height:1.7; padding:5px 0; }
.cost-note { font-size:11px; line-height:1.7; color:var(--muted); margin:14px 0; }
.cost-overview-line { display:flex; justify-content:space-between; gap:20px; margin-bottom:18px; font-size:14px; }
.cost-overview-line strong { font-size:16px; font-weight:500; }
.cost-list-heading { font-size:15px; font-weight:500; margin:30px 0 10px; }
@media(max-width:420px) { .cost-line { flex-wrap:wrap; gap:4px 12px; } .cost-group > summary { gap:12px; font-size:11px; } }

.cost-group > summary::-webkit-details-marker { display:none; }

/* Quiet search excerpts in the existing book index. */
.entry-row mark { color:var(--ink); background:#686f5220; border-radius:3px; padding:0 .06em; box-decoration-break:clone; }
.search-status { color:var(--muted); font-size:13px; line-height:1.6; margin:12px 0; }
.search-status:empty { display:none; }

.chapter-entries > .chapter { margin-left:18px; border-bottom:0; border-left:1px solid var(--line); padding-left:18px; }
.chapter-entries > .chapter > summary { padding:16px 0; }
.chapter-entries > .chapter .chapter-name { font-size:17px; font-weight:400; }
@media(max-width:600px) { .chapter-entries > .chapter { margin-left:7px; padding-left:12px; } }

.draft-tools { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin:18px 0 0; color:var(--muted); font-size:11px; }
.draft-tools p { margin:0; line-height:1.7; }
.draft-tools button { color:var(--muted); padding:8px 11px; border-radius:10px; background:#686f520b; font-size:11px; }
.draft-tools button:hover { background:#686f5218; }
.draft-others { margin:20px 0; color:var(--muted); font-size:12px; }
.draft-others summary { cursor:pointer; padding:10px 0; }
.draft-resume { display:flex; justify-content:space-between; align-items:center; gap:16px; width:100%; min-height:44px; padding:12px; border-bottom:1px solid var(--line); text-align:left; color:var(--ink); }
.draft-resume small { font-size:11px; color:var(--muted); }

/* Confirm within the writing surface instead of opening a browser prompt. */
.draft-confirm { margin-top:16px; padding:18px; background:#686f520b; border:1px solid var(--line); border-radius:16px; }
.draft-confirm p { margin:0 0 14px; color:var(--ink); font-size:13px; }
.draft-confirm-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:10px; }
.draft-confirm-actions button { padding:11px 16px; border-radius:12px; font-size:12px; }
.rewrite-pending { margin:0 0 22px; font-size:12px; color:var(--muted); }
.rewrite-pending summary { cursor:pointer; padding:10px 0; }
.rewrite-pending button { display:block; width:100%; text-align:left; padding:12px; border-radius:12px; margin:4px 0; line-height:1.6; }
.rewrite-pending button[aria-pressed="true"] { background:#686f5210; color:var(--accent); }
.rewrite-pending button small { display:block; color:var(--muted); font-size:11px; }

.entry-connections + .related { margin-top:22px; }
.entry-connection { padding:6px 0 12px; }
.entry-connection p { margin:0; max-width:540px; color:var(--muted); font-size:12px; line-height:1.8; white-space:pre-wrap; overflow-wrap:anywhere; }

/* Lists remain typography on paper, with no extra cards or borders. */
.entry-list-pair { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:32px; margin:0 0 24px; }
.entry-list { min-width:0; margin:0 0 24px; }
.entry-list-pair .entry-list { margin:0; }
.entry-list .entry-list-heading { font:inherit; font-weight:500; margin:0 0 12px; color:var(--ink); }
.entry-list-items { margin:0; padding-left:1.1em; list-style:disc; }
.entry-list-items li { padding-left:.2em; margin:0 0 .35em; overflow-wrap:anywhere; }
.entry-list-items li::marker { color:var(--muted); font-size:.65em; }
@media (max-width:600px) { .entry-list-pair { grid-template-columns:1fr; gap:24px; } }

/* Mobile pages share one fluid gutter; content determines their height. */
@media (max-width:600px) {
  :root { --mobile-gutter:clamp(16px, 4vw, 24px); }
  html { min-height:100%; }
  body { width:100%; min-height:100svh; }
  .book { width:100%; max-width:none; padding-inline:var(--mobile-gutter); }
  .book-header { margin-inline:var(--mobile-gutter); }
  .book-nav { margin-top:18px; flex-wrap:wrap; gap:8px 16px; }
  .reading-page, #contents { padding-top:28px; min-height:0; }
  .contents-heading { flex-wrap:wrap; gap:10px 16px; }
  .contents-heading h1 { overflow-wrap:anywhere; }
  #reader-title, .reader-body { overflow-wrap:anywhere; }
}

/* One compact navigation row, with generous icon hit areas. */
.book-header { min-height:80px; height:auto; padding:12px 0; grid-template-columns:minmax(88px,1fr) auto minmax(88px,1fr); gap:12px; }
.book-header .book-name { grid-column:2; grid-row:1; margin:0; max-width:none; justify-self:center; }
.book-header .contents-open { grid-column:1; grid-row:1; justify-self:start; }
.book-header .header-actions { grid-column:3; grid-row:1; gap:6px; }
.book-header :is(.contents-open,.account-link,.add-button) { display:inline-flex; justify-content:center; align-items:center; width:44px; min-width:44px; height:44px; min-height:44px; padding:10px; border-radius:13px; color:var(--ink); position:relative; }
.book-header :is(.contents-open,.account-link,.add-button):hover { background:#686f5210; }
.book-header svg { width:24px; height:24px; flex-shrink:0; }
.reading-page { padding-top:32px; }
@media(max-width:600px) {
  .book-header { min-height:72px; padding:8px 0; gap:4px; grid-template-columns:minmax(44px,1fr) auto minmax(88px,1fr); }
  .book-header .book-name { font-size:16px; }
  .book-header .brand-title { gap:7px; }
  .book-header .brand-logo { width:30px; flex-basis:30px; }
  .book-header .header-actions { gap:0; }
  .reading-page { padding-top:24px; }
}
@media(max-width:340px) {
  .book-header .book-name { font-size:14px; letter-spacing:-.5px; }
  .book-header .brand-title { gap:5px; }
}

.book-header .account-link svg { width:22px; height:22px; stroke-width:1.4; }

/* Keep desktop navigation aligned with the reading column. */
@media(min-width:601px) {
  .book-header { width:calc(100% - 48px); max-width:648px; margin-inline:auto; }
}
@media(min-width:1400px) {
  .book-header { max-width:680px; }
}

/* Standalone iPhone layout: respect the camera area and home indicator. */
@media (display-mode:standalone) {
  body { padding-top:env(safe-area-inset-top); padding-bottom:env(safe-area-inset-bottom); padding-left:env(safe-area-inset-left); padding-right:env(safe-area-inset-right); min-height:100svh; }
}
@media(max-width:600px) {
  input:not([type=checkbox]):not([type=radio]), textarea, select,
  .account-page input:not([type=checkbox]), .account-page select { font-size:16px; }
}
.install-steps { padding-left:20px; margin:0 0 16px; font-size:14px; line-height:1.7; }
.install-steps li + li { margin-top:8px; }

/* Keep paging together; entry actions form a separate, compact mobile row. */
@media(max-width:600px) {
  .reader-date { margin-top:22px; }
  .reading-footer { flex-direction:column; align-items:stretch; gap:4px; margin-top:22px; padding-top:8px; }
  .reader-navigation { justify-content:space-between; gap:12px; }
  .reader-tools { gap:16px; flex-wrap:nowrap; }
  .reader-tools .rewrite-link { font-size:12px; }
  #reading > .related { margin-top:12px; }
  #reading > .related:not([hidden]) + .related { margin-top:4px; }
}
