.history-trigger {
  display: inline-flex; align-items: center; background: transparent; color: #e4d5bb;
  min-height: 44px; padding: 8px 0; text-decoration: underline; text-underline-offset: 5px; text-decoration-color: #82715b; font: 15px/1.6 "Songti SC", serif;
  letter-spacing: .08em; border-radius: 2px;
}
.history-trigger:hover { color: #f5e8ce; text-decoration-color: currentColor; }
.history-save-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
#historySaveStatus { color: #c9bda9; font: 13px/1.8 system-ui; margin: 0; }
#historyRetry { border: 1px solid #a98d67; color: #ecdac0; background: transparent; padding: 8px 14px; min-height: 44px; }
#reading .reading-actions .history-trigger { display: inline-flex; background: transparent; color: #e4d5bb; border: 0; justify-content: center; }
#historyPage {
  --history-ink: #eadfcb; --history-muted: #c3b59f; --history-line: #bca47c40;
  box-sizing: border-box; width: min(1000px, 100%); min-height: 100svh;
  margin: auto; padding: 32px 40px 64px;
  color: var(--history-ink);
  font: 16px/1.8 "Songti SC", "STSong", serif;
}
.history-page-body { margin: 0; background: #181713; }
.history-page-body * { box-sizing: border-box; }
#historyPage a { color: inherit; }
.history-page-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 36px; font-size: 14px; color: #c3b59f; }
.history-page-nav a { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: 5px; }
#historyPage [hidden] { display: none !important; }
#historyPage button { cursor: pointer; color: inherit; font: inherit; border-radius: 2px; }
#historyPage button:focus-visible, #historyPage a:focus-visible { outline: 2px solid #dcc196; outline-offset: 3px; }
#historyPage .history-header { display: flex; justify-content: space-between; align-items: start; gap: 24px; padding: 0 0 20px; border-bottom: 1px solid var(--history-line); }
.history-kicker { color: #c6aa7d; margin: 0 0 8px; font-size: 13px; letter-spacing: .14em; }
#historyTitle { font-size: 32px; line-height: 1.4; font-weight: 400; letter-spacing: .12em; margin: 0; }
#historyPrivacy { font: 13px/1.8 system-ui; color: var(--history-muted); margin: 20px 0 24px; }
#historyCount { font: 13px/1.6 system-ui; color: #c6aa7d; margin: 0 0 12px; }
#historyMessage { font-size: 17px; line-height: 1.9; margin: 0; }
#historyMessage:not(:empty) { padding: 42px 0 58px; }
#historyList { list-style: none; margin: 0; padding: 0; }
#historyList > li { border-top: 1px solid var(--history-line); }
#historyList > li:last-child { border-bottom: 1px solid var(--history-line); }
#historyPage .history-entry {
  display: grid; grid-template-columns: 154px minmax(0, 1fr) auto; width: 100%; gap: 24px;
  align-items: center; text-align: left; padding: 22px 8px; background: transparent; border: 0; text-decoration: none;
}
#historyPage .history-entry:hover { background: #e8d7b90a; }
.history-entry-time { font: 13px/1.8 system-ui; color: var(--history-muted); font-variant-numeric: tabular-nums; }
.history-entry-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.history-entry-copy strong { font-size: 20px; font-weight: 400; }
.history-entry-copy > span { font-size: 14px; color: var(--history-muted); }
.history-entry-action { font-size: 14px; color: #d0b78e; white-space: nowrap; }
#historyBack, #historyMore { min-height: 44px; padding: 8px 14px; background: transparent; border: 1px solid #82715b; }
#historyBack { display: inline-flex; align-items: center; border: 0; padding-inline: 0; margin: 0 0 22px; text-underline-offset: 5px; }
#historyMore { margin-top: 24px; }
.history-detail-title { margin: 0; font-size: 24px; line-height: 1.5; font-weight: 400; }
.history-detail-time { display: block; color: var(--history-muted); font: 13px/1.8 system-ui; margin: 8px 0 24px; }
.history-detail-body { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr); align-items: start; gap: 36px; }
.history-paper { margin: 0; padding: 32px 26px; color: #302a22; background: linear-gradient(#e9e1cef2, #e9e1cef2), url('../assets/paper-fibre.svg'); border: 1px solid #c1af8c; text-align: center; }
.history-paper figcaption { font-size: 14px; letter-spacing: .12em; color: #6a4a36; }
.history-paper blockquote { font: 22px/1.8 "Kaiti SC", "STKaiti", "KaiTi", serif; margin: 28px 0; }
.history-paper blockquote span { display: block; margin-bottom: 10px; overflow-wrap: anywhere; }
.history-paper-allusion { margin: 0; font-size: 15px; }
.history-notes { min-width: 0; overflow-wrap: anywhere; }
.history-grade { color: #dac092; font-size: 14px; margin: 0 0 8px; }
.history-notes .history-headline { font-size: 22px; font-weight: 400; margin: 0 0 20px; }
.history-notes section { border-top: 1px solid var(--history-line); padding: 18px 0; }
.history-notes h4 { color: #d5bc95; font-size: 15px; font-weight: 400; margin: 0 0 10px; }
.history-notes p { margin: 0; font-size: 16px; line-height: 1.95; white-space: pre-line; }
.history-context { font-size: 13px; color: var(--history-muted); border-top: 1px solid var(--history-line); padding-top: 16px; }
.history-context summary { cursor: pointer; min-height: 44px; }
.history-context p { font: 13px/1.8 system-ui; margin: 0 0 12px; }
.history-context a { color: #dfc7a2; }
.history-footnote, .history-legacy-note { color: var(--history-muted); font: 13px/1.9 system-ui; margin: 24px 0 0; }
@media (max-width: 600px) {
  #historyPage { padding: 20px 20px max(36px, env(safe-area-inset-bottom)); }
  .history-page-nav { margin-bottom: 24px; }
  #historyTitle { font-size: 27px; }
  .history-kicker { font-size: 12px; }
  #historyPage .history-entry { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 18px 2px; }
  .history-entry-time { grid-column: 1 / -1; }
  .history-entry-copy strong { font-size: 18px; }
  .history-entry-action { font-size: 13px; }
  .history-detail-body { grid-template-columns: 1fr; gap: 28px; }
  .history-paper { max-width: 360px; width: 100%; justify-self: center; }
  .history-trigger { font-size: 14px; }
}

/* Final sign is a baked image: device fonts cannot change its typography. */
#reading #physicalScroll.has-slip-artwork { width:100%; height:auto; min-height:0; aspect-ratio:2/3; padding:0; border:0; border-radius:2px; background:#e9e1ce url('../assets/paper-fibre.svg'); box-shadow:0 18px 42px #0005; transform:none; overflow:hidden; }
#reading #physicalScroll.has-slip-artwork::before, #reading #physicalScroll.has-slip-artwork::after { display:none; }
.has-slip-artwork > .slip-artwork { display:block; width:100%; height:auto; margin:0; position:relative; object-fit:contain; opacity:0; transition:opacity 180ms ease-out; }
.has-slip-artwork.is-artwork-ready > .slip-artwork { opacity:1; }
#physicalScroll.has-slip-artwork > canvas, #physicalScroll.has-slip-artwork > .scroll-copy { display:none; }
.history-paper.has-slip-artwork { padding:0; border:0; aspect-ratio:2/3; background:#e9e1ce url('../assets/paper-fibre.svg'); overflow:hidden; border-radius:2px; }
.history-paper.has-slip-artwork > :not(.slip-artwork) { display:none; }
@media (prefers-reduced-motion: reduce) { .has-slip-artwork > .slip-artwork { transition:none; } }
