/* The memory reader is a paper sheet independent of editor and reading-room styles. */
.memory-reader {
  width: min(1000px, calc(100% - 48px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  color: var(--house-ink);
  background: var(--house-sheet);
  border: 1px solid var(--house-rule);
  border-radius: 8px;
  box-shadow: var(--house-shadow);
  overflow: auto;
  overscroll-behavior: contain;
}
.memory-reader::backdrop { background: rgba(38, 37, 31, .42); backdrop-filter: blur(4px); }
.memory-reader-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 32px 40px 12px; }
.memory-reader-header h3 { margin: 0; font: 500 clamp(23px, 3vw, 32px)/1.45 Georgia, "Songti SC", serif; overflow-wrap: anywhere; }
.memory-reader .eyebrow { color: var(--house-moss); font-size: 10px; }
.memory-reader-subhead { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 0 40px 24px; color: var(--house-faded); font-size: 12px; }
.history-arc-link { margin-left: auto; padding: 6px 10px; color: var(--house-moss); border: 1px solid var(--house-rule); border-radius: 999px; background: rgba(116, 131, 107, .05); }
.history-close { flex: 0 0 36px; min-height: 36px; padding: 0; border: 0; background: transparent; color: var(--house-faded); font-size: 28px; }
.history-tabs { position: sticky; top: 0; z-index: 1; display: flex; gap: 24px; padding: 0 40px; border-block: 1px solid var(--house-rule); background: var(--house-sheet); }
.history-button { color: var(--house-ink); background: transparent; border: 1px solid var(--house-rule); border-radius: 4px; padding: 10px 14px; }
.history-tabs .history-button { border: 0; border-radius: 0; padding: 15px 0; font-size: 13px; border-bottom: 2px solid transparent; }
.history-tabs [aria-current="page"] { color: var(--house-moss); border-bottom-color: var(--house-moss); }
.memory-reader-content { padding: 28px 40px 40px; }
.memory-reader :is(button, a, select, summary):focus-visible { outline: 2px solid var(--house-moss); outline-offset: 4px; }
.history-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0 0 24px; }
.history-meta div { min-width: 0; }
.history-meta dt { margin-bottom: 5px; color: var(--house-faded); font-size: 11px; }
.history-meta dd { margin: 0; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.history-section-title { margin: 8px 0 24px; font: 500 19px/1.6 Georgia, "Songti SC", serif; }
.history-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.95; }
.history-body { font-family: Georgia, "Songti SC", serif; font-size: 16px; }
.history-recall-summary { margin: 0 0 28px; padding: 18px 22px; background: rgba(116, 131, 107, .07); border-left: 2px solid var(--house-moss); }
.history-recall-summary h4 { margin: 0 0 10px; font-size: 12px; color: var(--house-moss); }
.history-tags { color: var(--house-moss); font-size: 12px; line-height: 1.8; }
.history-identity, .history-judgments { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--house-rule); }
.memory-reader summary { cursor: pointer; font-size: 13px; line-height: 1.8; }
.history-identity .history-meta { grid-template-columns: 1fr; margin-top: 20px; }
.history-empty { margin: 16px 0; color: var(--house-faded); font-size: 13px; line-height: 1.8; }
.history-timeline-controls { display: flex; flex-wrap: wrap; gap: 16px; margin: 0 0 24px; }
.history-select { display: grid; gap: 8px; color: var(--house-faded); font-size: 11px; min-width: 0; max-width: 100%; }
.history-select select { max-width: 100%; padding: 10px 12px; color: var(--house-ink); border: 1px solid var(--house-rule); border-radius: 4px; background: var(--house-sheet); font-size: 12px; }
.history-branch { margin: 0 0 32px; }
.history-branch-heading { display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--house-rule); padding-bottom: 12px; }
.history-branch-heading h5 { margin: 0; font-size: 15px; font-weight: 500; }
.history-pill { display: inline-block; color: var(--house-faded); border: 1px solid var(--house-rule); padding: 3px 8px; border-radius: 3px; font-size: 10px; }
.history-pill.status-active { color: #56674b; background: #eef0e6; border-color: #ccd4bf; }
.history-current { font-size: 12px; line-height: 1.8; margin: 14px 0 24px; }
.history-record-link { color: inherit; text-decoration-color: rgba(116, 131, 107, .5); text-underline-offset: 4px; overflow-wrap: anywhere; }
.history-track { list-style: none; padding: 0 0 0 24px; margin: 0 0 0 5px; border-left: 1px solid var(--house-rule); }
.history-event { position: relative; margin-bottom: 20px; padding: 18px 22px; border: 1px solid transparent; }
.history-event::before { content: ""; position: absolute; top: 26px; left: -30px; width: 9px; height: 9px; border: 1px solid var(--house-moss); border-radius: 50%; background: var(--house-sheet); }
.history-event.selected { background: rgba(116, 131, 107, .045); border-color: var(--house-rule); }
.history-event.selected::before { background: var(--house-moss); }
.history-event-heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.history-event-heading time { color: var(--house-faded); font-size: 11px; }
.history-event > .history-record-link { font: 500 17px/1.6 Georgia, "Songti SC", serif; }
.history-summary { color: #69665d; font-size: 12px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-event .history-meta { margin: 16px 0; }
.history-relation, .history-receipt { font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.history-receipt { color: var(--house-faded); margin-bottom: 0; }
.history-evidence-card { padding: 24px 0; border-bottom: 1px solid var(--house-rule); }
.history-evidence-card:first-of-type { padding-top: 0; }
.history-evidence-card h5 { margin: 0 0 16px; font-size: 14px; font-weight: 500; }
.history-quote { white-space: pre-wrap; overflow-wrap: anywhere; margin: 20px 0; padding: 8px 0 8px 20px; border-left: 2px solid var(--house-moss); font: 16px/1.9 Georgia, "Songti SC", serif; }
.history-source[open] > summary { margin-bottom: 20px; }
.history-original { white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.9 Georgia, "Songti SC", serif; padding: 20px; background: rgba(116, 131, 107, .05); }
.memory-list-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 22px; color: var(--house-faded); font-size: 12px; }
@media (max-width: 600px) {
  .memory-reader { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .memory-reader-header { padding: max(22px, env(safe-area-inset-top)) 20px 12px; }
  .memory-reader-subhead { padding: 0 20px 20px; }
  .history-tabs { padding: 0 20px; gap: 22px; }
  .memory-reader-content { padding: 24px 20px max(28px, env(safe-area-inset-bottom)); }
  .history-meta { grid-template-columns: 1fr; gap: 12px; }
  .history-meta div { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; }
  .history-meta dt { margin: 0; align-self: baseline; }
  .history-track { padding-left: 15px; }
  .history-event { padding: 15px 12px; }
  .history-event::before { left: -21px; top: 22px; }
  .history-original { padding: 14px; }
}
