.memoir-shelf-intro { color: var(--text-secondary, #75665b); margin: 8px 0 28px; }
.memoir-shelf-month { border-left: 1px solid #dfd0c0; padding-left: 22px; margin: 24px 0 36px; position: relative; }
.memoir-shelf-month h4 { font-size: 20px; margin: 0 0 24px; }
.memoir-shelf-month h4::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: #ad5637; position: absolute; left: -6px; top: 10px; }
.memoir-shelf-rack { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 28px; }
.memoir-shelf-item { min-width: 0; max-width: 280px; }
.memoir-book-cover { display: flex; flex-direction: column; align-items: flex-start; text-align: left; width: 100%; aspect-ratio: 3/4; min-height: 240px; padding: 22px 20px; border: 0; border-left: 7px solid #bac793; border-radius: 2px 8px 8px 2px; background: #e3ecb6; color: #293e2f; box-shadow: 5px 5px 0 #dfd4c4, 0 16px 20px -15px #746b54; cursor: pointer; transition: transform .2s; font: inherit; overflow-wrap: anywhere; }
.memoir-book-cover:hover { transform: translateY(-4px); }
.memoir-book-cover small { font-size: 14px; letter-spacing: 2px; }
.memoir-book-cover strong { font-size: 22px; line-height: 1.6; margin: 24px 0 auto; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.memoir-book-cover span { font-size: 16px; line-height: 1.7; margin-top: 22px; }
.memoir-shelf-item time { display: block; margin-top: 20px; color: var(--text-secondary, #75665b); }
.memoir-shelf-actions { display: flex; justify-content: space-between; gap: 8px; border-bottom: 3px solid #dfd0c0; }
.memoir-shelf-actions button { background: transparent; border: 0; min-height: 48px; color: var(--text-secondary, #75665b); font: inherit; cursor: pointer; }
.memoir-reader-dialog { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; max-width: none; max-height: none; border: 0; padding: 0; margin: 0; background: #faf7ef; color: #342e28; }
.memoir-reader-dialog[open] { display: flex; flex-direction: column; }
.memoir-reader-bar { display: flex; align-items: center; gap: 20px; padding: 12px 18px; padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 1px solid #dfd0c0; }
.memoir-reader-bar button { flex-shrink: 0; border: 1px solid #d7c7b7; border-radius: 5px; padding: 12px 16px; min-height: 48px; background: #fffdf8; color: #55463c; font: inherit; cursor: pointer; }
.memoir-reader-bar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memoir-reader-dialog iframe { width: 100%; flex: 1; min-height: 0; border: 0; }
.memoir-book-cover:focus-visible, .memoir-shelf-actions button:focus-visible, .memoir-reader-bar button:focus-visible { outline: 3px solid #af5030; outline-offset: 4px; }
@media(max-width: 520px) { .memoir-shelf-rack { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 16px; } .memoir-shelf-month { padding-left: 12px; } .memoir-book-cover { min-height: 220px; padding: 18px 12px; } .memoir-book-cover strong { font-size: 18px; margin-top: 18px; } .memoir-book-cover span, .memoir-book-cover small { font-size: 14px; } .memoir-reader-bar { gap: 12px; padding-inline: 12px; } }
@media(prefers-reduced-motion: reduce) { .memoir-book-cover { transition: none; } }

#memoirPage .memoir-recording { margin: 16px 0; padding: 18px; border: 1px solid #e5d8c9; border-radius: 18px; background: #faf6ed; }
#memoirPage .memoir-record-actions { display: flex; flex-wrap: wrap; gap: 10px; }
#memoirPage .memoir-recording audio { width: 100%; margin: 12px 0; }
#memoirPage #memoirSentenceEditor label { display: block; margin: 14px 0; font-weight: 700; }
#memoirPage #memoirSentenceEditor textarea { display: block; box-sizing: border-box; width: 100%; font: inherit; line-height: 1.7; padding: 12px; border: 1px solid #cabaa3; border-radius: 12px; }
#memoirPage #memoirRecordStatus { line-height: 1.7; margin: 12px 0; }

/* Indeterminate activity: the service does not report a completion percentage. */
#memoirPage .is-transcribing #memoirRecordStatus,
#memoirPage .is-transcribing #memoirTranscribeRetry {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #285342;
    background: #edf4ef;
    border: 2px solid #8aab98;
    border-radius: 12px;
    padding: 14px;
    font-weight: 700;
    opacity: 1;
}
#memoirPage .is-transcribing #memoirRecordStatus::before,
#memoirPage .is-transcribing #memoirTranscribeRetry::before {
    content: '';
    display: block;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    box-sizing: border-box;
    border: 4px solid #c2d5c8;
    border-top-color: #285342;
    border-radius: 50%;
    animation: memoir-transcribing-spin 1s linear infinite;
}
@keyframes memoir-transcribing-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    #memoirPage .is-transcribing #memoirRecordStatus::before,
    #memoirPage .is-transcribing #memoirTranscribeRetry::before { animation: none; }
}

#memoirPage [hidden] { display: none !important; }

/* Clear recording steps; secondary decisions stay separate from recording. */
#memoirPage .memoir-record-destination { padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid #d9ccbb; }
#memoirPage .memoir-record-destination strong { font-size: 18px; color: #5a4b3b; }
#memoirPage #memoirRecordTarget { margin: 8px 0 14px; overflow-wrap: anywhere; }
#memoirPage #memoirRecordStep { margin: 0 0 16px; font-size: 22px; line-height: 1.5; }
#memoirPage .memoir-record-actions { display: block; }
#memoirPage .memoir-recording .btn, #memoirPage #memoirSaveButton { width: 100%; min-height: 56px; font-size: 20px; white-space: normal; line-height: 1.5; padding: 14px 16px; border-radius: 12px; }
#memoirPage .memoir-record-actions .btn { min-height: 68px; font-size: 24px; }
#memoirPage #memoirRecordStop { background: #a53c29; color: white; border: 2px solid #a53c29; }
#memoirPage .memoir-record-secondary { margin-top: 24px; padding-top: 18px; border-top: 1px solid #d9ccbb; }
#memoirPage .memoir-record-secondary p { margin: 0 0 12px; color: #645448; }
#memoirPage .memoir-recording button:focus-visible { outline: 3px solid #32634f; outline-offset: 4px; }

#memoirPage .memoir-quota { padding: 16px; border: 2px solid #8aab98; border-radius: 14px; background: #edf4ef; color: #285342; margin: 16px 0; line-height: 1.7; }
#memoirPage #memoirQuotaText { font-size: 22px; font-weight: 700; margin: 0; }
#memoirPage .memoir-quota .btn { min-height: 56px; width: 100%; white-space: normal; }
