/* Journal presentation approved from the Waynture mockup. */
.journal-book-promo{display:flex;align-items:center;gap:14px;box-sizing:border-box;margin:8px 0 14px;padding:14px;border:1px solid #ff9a68;border-radius:18px;background:linear-gradient(115deg,#fff8f1,#fff1e7);color:#002d72;box-shadow:0 4px 14px #002d7208}
.journal-book-art{flex:0 0 100px;width:100px;height:112px;display:flex;align-items:center;justify-content:center}
.journal-book-art img{display:block;max-width:100%;max-height:112px;width:100px;height:auto;object-fit:contain}
.journal-book-art.has-cover{height:110px;filter:drop-shadow(0 4px 4px #00193833)}
.journal-book-art.has-cover img{border-radius:5px 10px 10px 5px;border-left:5px solid #153d73;max-height:108px;object-fit:contain;background:#fff}
.journal-book-copy{min-width:0;flex:1}.journal-book-copy>strong{display:block;font-size:1rem;line-height:1.25;letter-spacing:-.02em;color:#002d72}
.journal-book-copy>p{font-size:.78rem;line-height:1.4;margin:6px 0 10px;color:#5b6f8b}
body .journal-book-cta{display:inline-flex;align-items:center;justify-content:center;min-height:44px;box-sizing:border-box;max-width:100%;padding:9px 14px;border:1px solid #ff5910;border-radius:14px;background:#ff5910;color:#002d72;font:inherit;font-size:.8rem;font-weight:750;line-height:1.3;white-space:normal;cursor:pointer;box-shadow:0 3px 8px #ff59101a}
.journal-book-cta:disabled{opacity:.55;cursor:default}.journal-book-cta:focus-visible{outline:3px solid #002d72;outline-offset:3px}
.journal-entry,.journal-card{position:relative;border-radius:18px!important;border:1px solid var(--line,#dbe3ef);box-shadow:0 4px 16px #002d7208}
.journal-entry>.pill{align-self:start;width:fit-content;border-radius:10px;margin-right:48px}
.journal-entry>strong,.journal-card h4{padding-right:42px}
.journal-entry figure,.journal-card figure{margin:0;min-width:0}
body .journal-browser .media-photo-frame,.journal-card .journal-photo>a{display:block;width:100%;padding:0;border:0;border-radius:14px;overflow:hidden;background:transparent;line-height:0}
body .journal-browser .media-photo-frame img,.journal-card .journal-photo img{display:block;max-width:100%;height:auto;border-radius:14px!important;object-fit:contain}
.journal-entry-menu{position:absolute;right:12px;top:12px;z-index:4}
.journal-entry-menu>summary,.journal-photo-menu>summary{display:flex;align-items:center;justify-content:center;width:44px;height:44px;list-style:none;border-radius:14px;color:var(--ink,#002d72);font-size:26px;cursor:pointer;background:var(--surface,#fff)}
.journal-entry-menu>summary::-webkit-details-marker,.journal-photo-menu>summary::-webkit-details-marker{display:none}
.journal-entry-menu>summary:focus-visible,.journal-photo-menu>summary:focus-visible{outline:2px solid #ff5910;outline-offset:2px}
.journal-menu-panel{box-sizing:border-box;position:absolute;top:48px;right:0;width:min(280px,78vw);max-height:65dvh;overflow:auto;overscroll-behavior:contain;padding:10px;border:1px solid var(--line,#dbe3ef);border-radius:16px;background:var(--surface,#fff);box-shadow:0 12px 32px #00193826;color:var(--ink,#002d72)}
.journal-menu-panel .journal-existing-tools,.journal-menu-panel .journal-entry-actions{margin:0;background:transparent;padding:0;display:flex;flex-wrap:wrap;gap:8px}
.journal-photos>div{position:relative}.journal-photo-menu{position:absolute;top:8px;right:8px;z-index:3}.journal-photo-menu>summary{background:#ffffffed;color:#002d72}
.journal-entry [data-journal-album]>small{font-size:.7rem;color:var(--muted)}
.journal-browser>.journal-view-switch{border-radius:16px;margin:0 auto 10px}.journal-browser>.journal-view-switch::before{border-radius:13px}
body .journal-browser>.journal-view-switch>button{border-radius:13px}
.journal-browser .journal-reader-controls>button{border-radius:50%;min-width:44px;width:44px;height:44px}
.journal-layout-switch{display:grid;grid-template-columns:1fr 1fr;width:min(340px,100%);margin:0 auto 12px;padding:3px;background:var(--surface,#fff);border:1px solid var(--line,#dbe3ef);border-radius:16px}
.journal-layout-switch[hidden]{display:none}.journal-layout-switch>button{min-height:44px;border:0;border-radius:13px;padding:8px;background:transparent;color:var(--ink,#002d72);font:inherit;font-weight:650;font-size:.85rem}
.journal-layout-switch>button[aria-pressed=true]{background:#ff5910;color:#002d72}
.journal-list.is-mosaic{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}
.journal-mosaic-tile{padding:0;border:1px solid var(--line,#dbe3ef);border-radius:16px;overflow:hidden;background:var(--surface,#fff);color:var(--ink,#002d72);text-align:left;font:inherit;cursor:pointer;min-height:100px}
.journal-mosaic-tile img{display:block;width:100%;height:160px;object-fit:cover;background:var(--paper,#f3f6fa)}.journal-mosaic-tile strong{display:block;padding:10px;font-size:.9rem}
@media(max-width:350px){.journal-book-promo{gap:10px;padding:12px}.journal-book-art{flex-basis:78px;width:78px}.journal-book-copy>strong{font-size:.9rem}.journal-book-copy>p{font-size:.73rem}.journal-book-cta{padding:8px 10px!important;font-size:.75rem!important}}
@media(min-width:900px){.journal-book-promo{padding:16px 22px;gap:22px}.journal-book-copy>strong{font-size:1.15rem}.journal-book-copy>p{font-size:.9rem}.journal-book-art{flex-basis:122px;width:122px}}

.journal-photo{position:relative}.journal-inline-menu{position:relative;width:44px;margin-top:8px}
.journal-inline-menu>summary{display:flex;align-items:center;justify-content:center;width:44px;height:44px;font-size:26px;list-style:none;cursor:pointer;border-radius:14px}
.journal-inline-menu>summary::-webkit-details-marker{display:none}
.journal-menu-panel .record-actions{display:contents!important}
.journal-menu-panel .journal-media-tools>button,.journal-menu-panel .record-actions>button,.journal-menu-panel .journal-entry-actions>button{width:100%!important;height:auto!important;min-height:44px!important;display:flex;gap:8px;align-items:center;justify-content:flex-start;padding:10px!important;border-radius:12px!important}
.journal-menu-panel .journal-media-tools>button[title]::after,.journal-menu-panel .record-actions>button[title]::after{content:attr(title);font-size:.82rem;line-height:1.3}
.journal-menu-panel .journal-photo-controls{display:flex;flex-wrap:wrap;gap:8px;padding:0;border:0}
.journal-menu-panel .journal-photo-controls input{width:100%;box-sizing:border-box}

.journal-entry-menu>summary{border:0;background:transparent;box-shadow:none}
.journal-book-cta{gap:8px}.journal-book-cta svg{flex:none;width:20px;height:20px}

/* Override the legacy square-photo rules without reintroducing cropping. */
body .journal-browser .journal-photos button.media-photo-frame{border-radius:14px!important;overflow:hidden;aspect-ratio:auto;min-height:0}
body .journal-browser .journal-photos button.media-photo-frame>img{border-radius:14px!important;object-fit:contain;aspect-ratio:auto;height:auto;max-height:none}

/* Lift journal photos softly from the page, keeping the rounded image edge. */
body .journal-browser .media-photo-frame,.journal-card .journal-photo>a{box-shadow:0 4px 12px rgba(0,32,80,.16),0 1px 3px rgba(0,32,80,.08)}
.journal-mosaic-tile{box-shadow:0 4px 12px rgba(0,32,80,.12)}

/* Printed-book silhouettes; preserve each album's format and show up to three covers. */
.journal-book-art,.journal-book-art.has-cover{position:relative;flex:0 0 100px;width:100px;height:112px;filter:none;perspective:500px}
.journal-mini-book{position:absolute;display:block;max-width:94px;max-height:100px;height:100px;aspect-ratio:1;overflow:hidden;border-radius:3px 7px 7px 3px;background:#002d72;box-shadow:3px 5px 9px #00193838;transform:rotateY(-12deg);border-left:5px solid #002453}
.journal-mini-book:after{content:'';position:absolute;inset:0;pointer-events:none;background:linear-gradient(90deg,#ffffff38,transparent 7%,#00193826 10%,transparent 14%);border:1px solid #ffffff24;border-radius:inherit}
.journal-book-art .journal-mini-book>img,.journal-book-art.has-cover .journal-mini-book>img{display:block;width:100%;height:100%;max-width:none;max-height:none;object-fit:cover;border:0;border-radius:0;background:#002d72}
.journal-book-art.is-stack .journal-mini-book{transform:translate(calc((var(--book-order) - 1)*6px),calc((var(--book-order) - 1)*-3px)) rotate(calc((var(--book-order) - 1)*8deg)) rotateY(-12deg)}
@media(min-width:900px){.journal-book-art,.journal-book-art.has-cover{flex-basis:122px;width:122px}}
@media(max-width:350px){.journal-book-art,.journal-book-art.has-cover{flex-basis:78px;width:78px}.journal-mini-book{max-width:74px;max-height:88px}}

/* Let the photograph show through the action trigger, keeping its menu readable. */
.journal-photo-menu>summary{background:rgba(255,255,255,.72);color:#002d72;box-shadow:0 2px 8px #00193818;backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}
.journal-photo-menu[open]>summary,.journal-photo-menu>summary:hover,.journal-photo-menu>summary:focus-visible{background:rgba(255,255,255,.94)}
/* Keep journal actions readable on narrow screens, independent of toolbar sizing. */
body .journal-menu-panel .journal-existing-tools,body .journal-menu-panel .journal-entry-actions{display:flex!important;flex-direction:column!important;align-items:stretch!important;flex-wrap:nowrap!important;width:100%;min-width:0;gap:6px}
body .journal-menu-panel .journal-media-tools>button,body .journal-menu-panel .record-actions>button,body .journal-menu-panel .journal-entry-actions>button{flex:0 0 auto!important;width:100%!important;max-width:none!important;min-width:0!important;min-height:46px!important;height:auto!important;box-sizing:border-box;white-space:normal!important;word-break:normal!important;overflow-wrap:normal!important;text-align:left;color:var(--ink,#002d72);background:var(--surface,#fff)}
body .journal-menu-panel button[title]::after{flex:1 1 auto;min-width:0;white-space:normal;word-break:normal;overflow-wrap:break-word}
body .journal-menu-panel button>.journal-icon{flex:0 0 24px!important;width:24px!important;height:24px!important;background:transparent!important;box-shadow:none!important;color:inherit}

/* 2.39.97: compact memory tiles and persistent reader navigation. */
body .memory-mosaic{display:grid;grid-template-columns:repeat(auto-fill,minmax(100px,1fr));gap:8px}
body .mosaic-tile,body .journal-mosaic-tile{position:relative;aspect-ratio:1;min-height:0!important;height:auto!important;padding:0!important;overflow:hidden;border-radius:14px!important;box-shadow:0 3px 10px #00193818}
body .mosaic-tile img,body .journal-mosaic-tile img{width:100%!important;height:100%!important;object-fit:cover;position:absolute;inset:0;border-radius:inherit}
body .mosaic-caption,body .journal-mosaic-tile>strong{position:absolute;bottom:0;left:0;right:0;padding:18px 7px 6px;background:linear-gradient(transparent,#000b);color:white;font-size:.75rem;line-height:1.2;max-height:55%;overflow:hidden}
body .mosaic-caption small{display:none}
body .is-mosaic:has(>.journal-mosaic-tile){grid-template-columns:repeat(auto-fill,minmax(100px,1fr))!important;gap:8px}
body .journal-detail-return{position:sticky;top:0;z-index:8;display:flex;gap:8px;justify-content:space-between;background:var(--surface,#fff);color:var(--ink,#002d72);padding:8px;border-bottom:1px solid var(--line,#dbe3ef);grid-column:1 / -1}
body .journal-detail-return button{font-size:.85rem;min-height:44px;margin:0;flex:0 1 auto}
body .journal-save-progress progress{display:block;width:100%;height:8px;margin:16px 0 10px;accent-color:#ff5910}
body .journal-save-progress p{font-size:.875rem!important;line-height:1.45;color:var(--muted,#596b82)!important;overflow-wrap:anywhere}
:root[data-theme="dark"] .journal-save-progress p{color:#b9c6d8!important}
:root[data-theme="dark"] .journal-save-progress{background:#152238!important;color:#e5edf7!important;border:1px solid #44536b}
:root[data-theme="dark"] .journal-detail-return{background:#152238!important;color:#e5edf7!important;border-color:#44536b}
:root[data-theme="dark"] .journal-detail-return button{background:#20334e!important;color:#e5edf7!important;border-color:#52647f}

/* Global preparation / upload dialog: explicit accessible surfaces in both themes. */
body dialog.journal-save-progress{box-sizing:border-box;width:min(420px,calc(100vw - 32px));padding:28px 24px!important;border:1px solid #cad6e5!important;border-top:4px solid #ff5910!important;border-radius:24px!important;background:#fff!important;color:#092f65!important;box-shadow:0 24px 72px #00152e40;text-align:center}
body dialog.journal-save-progress h2{font-size:1.1rem!important;line-height:1.4;margin:16px 0 8px;color:inherit!important}
body dialog.journal-save-progress .journal-global-number{display:block;font-size:2rem;line-height:1.2;font-weight:750;color:inherit;margin:10px 0}
body dialog.journal-save-progress p{color:#526279!important;font-size:.85rem!important;line-height:1.45;margin:10px 0 0}
body dialog.journal-save-progress .journal-current-file{font-size:.75rem!important;overflow-wrap:anywhere;max-height:4.5em;overflow:auto}
body dialog.journal-save-progress progress{appearance:none;border:0;display:block;width:100%;height:10px;border-radius:8px;overflow:hidden;background:#e5ecf5}
body dialog.journal-save-progress progress::-webkit-progress-bar{background:#e5ecf5;border-radius:8px}
body dialog.journal-save-progress progress::-webkit-progress-value{background:linear-gradient(90deg,#ff5910,#ff923d);border-radius:8px;transition:width .15s}
body dialog.journal-save-progress progress::-moz-progress-bar{background:#ff5910;border-radius:8px}
:root[data-theme="dark"] body dialog.journal-save-progress{background:#10243e!important;color:#f3f7fc!important;border-color:#49617e!important;border-top-color:#ff5910!important}
:root[data-theme="dark"] body dialog.journal-save-progress p{color:#bdcce0!important}
:root[data-theme="dark"] body dialog.journal-save-progress progress::-webkit-progress-bar{background:#314861}
@media(prefers-color-scheme:dark){:root:not([data-theme="light"]) body dialog.journal-save-progress{background:#10243e!important;color:#f3f7fc!important;border-color:#49617e!important;border-top-color:#ff5910!important}:root:not([data-theme="light"]) body dialog.journal-save-progress p{color:#bdcce0!important}:root:not([data-theme="light"]) body dialog.journal-save-progress progress::-webkit-progress-bar{background:#314861}}
@media(prefers-reduced-motion:reduce){body dialog.journal-save-progress progress::-webkit-progress-value{transition:none}}

/* Memory recovery and saved-item focus, shared by web and mobile. */
.journal-error-summary{display:flex;flex-wrap:wrap;align-items:center;gap:.65rem;padding:1rem;margin:.75rem 0;border:1px solid #c63732;border-radius:16px;background:#fff1f0;color:#8f211d;}
.journal-error-summary[hidden]{display:none}.journal-error-summary label{display:flex;align-items:center;gap:.5rem;margin:0}.journal-error-summary input{width:auto}.journal-error-summary button{padding:.6rem .9rem;border:1px solid currentColor;border-radius:12px;background:transparent;color:inherit;cursor:pointer}
.journal-new-memory{outline:3px solid #ff5910!important;outline-offset:3px;box-shadow:0 0 0 7px #ff650826!important;scroll-margin:100px}
[data-theme="dark"] .journal-error-summary{background:#382126;color:#ffb8b3;border-color:#ef827a}
@media(prefers-color-scheme:dark){:root:not([data-theme="light"]) .journal-error-summary{background:#382126;color:#ffb8b3;border-color:#ef827a}}
