/* P1: object stories live on things; the top-right directory selects moments. */
#memories-dialog[open],#object-stories-dialog[open] {
  display:block;visibility:visible;opacity:1;position:absolute;inset:88px 32px auto auto;
  width:min(390px,calc(100vw - 32px));max-height:calc(100dvh - 170px);margin:0;
  padding:22px;border:1px solid #d3d4c7;border-radius:18px;background:#f7f6eef5;
  color:#35402f;box-shadow:0 14px 55px #25332124;z-index:12;overflow:auto;overscroll-behavior:contain;
}
#memories-dialog .memories-heading,#object-stories-dialog .memories-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
#memories-dialog .list-kicker,#object-stories-dialog .list-kicker{margin:0;font-size:13px;color:inherit;letter-spacing:1px}
#memories-dialog button,#object-stories-dialog button,#object-story-dialog button,#memory-strip button{font:inherit;cursor:pointer}
#close-memories,#close-object-stories,#object-story-close{min-width:44px;min-height:44px;border:0;border-radius:50%;background:transparent;font-size:24px!important}
.memory-directory-intro{margin:4px 0 16px;color:#69735f;font-size:12px;line-height:1.8}
#memory-scenes-list{display:grid;gap:10px}
.memory-scene-card{width:100%;display:grid;grid-template-columns:72px minmax(0,1fr);gap:10px;align-items:start;text-align:left;border:1px solid #dedfd2;border-radius:12px;background:#fffdf6;padding:12px;color:#35402f}
.memory-cover,.memory-cover-fallback{width:72px;height:54px;border-radius:8px;object-fit:cover;background:#e4e6da;color:#6d7564}
.memory-cover-fallback{display:grid;place-items:center;padding:4px;font-size:10px;line-height:1.3;text-align:center}
.memory-card-body{display:grid;gap:3px;min-width:0}
.memory-scene-card strong{font-size:15px;font-weight:600;line-height:1.5}
.memory-selected{display:none;margin-left:6px;font-style:normal;font-size:10px;letter-spacing:0;color:#5d7050}
.memory-scene-card[aria-pressed=true] .memory-selected{display:inline}
.memory-scene-card span{font-size:12px;line-height:1.7;color:#68735f}
.memory-objects{overflow-wrap:anywhere}
.memory-scene-card small{font-size:10px;letter-spacing:.5px;color:#777c6e}
.memory-scene-card:hover,.memory-scene-card[aria-pressed=true]{border-color:#667b55;background:#edf0e5}
.memory-scene-card[data-pending=true]{opacity:.65}
#memory-message{font-size:12px;line-height:1.7;margin:14px 0 4px;overflow-wrap:anywhere}
#memory-retry,#memory-cancel{min-height:44px;border-radius:8px;background:#e7eadf;padding:8px 14px;margin-top:8px}
#memory-strip{position:absolute;z-index:3;top:154px;left:40px;max-width:min(330px,calc(100vw - 40px));padding:12px 15px;border:1px solid #ffffffa0;border-radius:14px;background:#f8f8eee8;backdrop-filter:blur(12px);color:#35402f;box-shadow:0 4px 20px #2533210c}
#memory-strip .memory-strip-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
#memory-strip .memory-strip-kicker{display:block;color:#69735f;font-size:10px;letter-spacing:2px;margin-bottom:6px}
#memory-current-title{display:block;font-size:14px;font-weight:600;line-height:1.6}
#memory-exit{min-height:44px;white-space:nowrap;font-size:11px!important;padding:8px 10px;border:1px solid #d2d4c7;border-radius:10px;background:transparent}
#memory-related{display:flex;flex-wrap:wrap;gap:4px;margin-top:5px}
#memory-related button{font-size:11px!important;min-height:38px;background:transparent;border:0;padding:5px 8px;color:#637052;text-decoration:underline;text-underline-offset:4px}
body.story-open #memory-strip{display:none}
#object-story-dialog[open]{display:block;position:absolute;inset:auto auto 92px 50%;transform:translateX(-50%);width:min(370px,calc(100vw - 32px));max-height:calc(100dvh - 180px);overflow:auto;overscroll-behavior:contain;margin:0;padding:20px;border:1px solid #d3d4c7;border-radius:18px;background:#f8f7eff5;color:#35402f;box-shadow:0 12px 42px #25332126;z-index:12}
#object-story-close{position:absolute;right:8px;top:6px}
#object-story-dialog .object-story-kicker{margin:0 48px 8px 0;font-size:10px;letter-spacing:2px;color:#748168}
#object-story-title{margin:0 28px 8px 0;font-size:19px;font-weight:500;line-height:1.6}
#object-story-subtitle{font-size:12px;line-height:1.8;color:#68735f;margin:0 0 14px}
.object-story-buttons{display:flex;flex-wrap:wrap;gap:8px}
.object-story-buttons button{min-height:44px;border:1px solid #d2d4c7;border-radius:10px;padding:10px 14px;font-size:12px!important;background:#eef0e5}
#object-story-read{background:#536748;color:#fff8e9;border-color:#536748}
#object-stories-dialog .story-list-item{min-height:44px;font-size:13px}
#object-index-access{position:absolute;left:12px;bottom:12px;transform:translateY(180%);z-index:15;min-height:44px;border-radius:8px;background:#f7f6ed;padding:10px 14px}
#object-index-access:focus-visible{transform:none}
#fallback-stories,#about-stories{min-height:44px;padding:10px 14px;border-radius:8px;margin-top:8px;background:#e7eadf}
#memories-dialog button:focus-visible,#object-story-dialog button:focus-visible,#memory-strip button:focus-visible{outline:2px solid #9c583a;outline-offset:3px}
body.memory-active .intro{opacity:0;visibility:hidden;pointer-events:none}
body.night #memory-strip,body.night #object-story-dialog[open],body.night #memories-dialog[open],body.night #object-stories-dialog[open]{background:#27323bef;border-color:#71807866;color:#f4f1e4}
body.night .memory-directory-intro,body.night #object-story-subtitle,body.night #object-story-dialog .object-story-kicker,body.night #memory-strip .memory-strip-kicker,body.night #memory-related button{color:#c3cbbc}
body.night .memory-scene-card{background:#354048;color:#f4f1e4;border-color:#657269}
body.night .memory-scene-card span,body.night .memory-scene-card small,body.night .memory-selected{color:#ccd2c6}
body.night .memory-cover-fallback{background:#2c3840;color:#d5ddd4}
body.night .memory-scene-card[aria-pressed=true]{background:#455346;border-color:#a7b99b}
body.night #memory-exit{color:#f4f1e4}
@media(max-width:760px){
  #memories-dialog[open],#object-stories-dialog[open]{inset:78px 16px auto auto;max-height:calc(100dvh - 155px);padding:16px}
  .memory-scene-card{grid-template-columns:56px minmax(0,1fr);gap:8px;padding:10px}
  .memory-cover,.memory-cover-fallback{width:56px;height:42px}
  #memory-strip{top:auto;bottom:96px;left:16px;right:16px;max-width:none;padding:9px 12px}
  #memory-strip .memory-strip-kicker{display:none}
  #memory-related{margin-top:0}
  #object-story-dialog[open]{bottom:90px}
  body:has(#object-story-dialog[open]) #memory-strip{visibility:hidden}
}
@media(max-height:500px){#memory-strip{top:88px;bottom:auto;left:16px;max-width:300px}#memory-related{display:none}#memories-dialog[open],#object-stories-dialog[open]{top:65px;max-height:calc(100dvh - 100px)}}
@media(prefers-reduced-motion:reduce){#memories-dialog,#object-stories-dialog,.memory-scene-card,#object-story-dialog,#memory-strip{transition:none!important;animation:none!important}}

body.memory-ui-suspended #memory-strip{display:none}

.room-mode{display:flex;align-items:center;gap:8px;pointer-events:auto;max-width:none}
#room-mode-switch{min-height:44px;padding:8px 12px;border:1px solid #a7b09d70;border-radius:22px;background:#f3f3e7e8;color:#526346;font-size:12px;white-space:nowrap}
#room-mode-label{margin:0;font-size:10px;letter-spacing:.2px;color:#718066}
body.night #room-mode-switch{background:#27352ce8;color:#f2edde;border-color:#87968070}
body.reading-stories .object-control[data-story]{opacity:.78;pointer-events:auto;font-size:10px;min-height:36px;min-width:40px;padding:7px 9px;border:1px solid #81946d88;box-shadow:0 0 0 4px #e7edd83d;animation:story-breathe 3.6s ease-in-out infinite}
body.reading-stories .object-control[data-story]:focus-visible{opacity:1;animation:none;outline:2px solid #6f805f;outline-offset:3px}
@keyframes story-breathe{0%,100%{box-shadow:0 0 0 3px #e7edd83d}50%{box-shadow:0 0 0 7px #e7edd810}}
@media(prefers-reduced-motion:reduce){body.reading-stories .object-control[data-story]{animation:none;box-shadow:0 0 0 4px #e7edd82b}}
@media(max-width:760px){.room-mode{gap:5px;max-width:140px}#room-mode-switch{font-size:11px;padding:8px 10px}#room-mode-label{font-size:9px}body.story-open .room-mode{display:flex;visibility:visible;pointer-events:auto}body.story-open .scene-footer:has(.room-mode){visibility:visible;pointer-events:none;justify-content:space-between}}
