/* 朋友楼层的横向回忆轨道：每段回忆从年月节点向上生长。 */
body[data-page-section="friends"]:has(.memory-room) main.container{max-width:none!important;width:100%!important;min-height:calc(100svh - 96px);padding:0!important}
.memory-room{position:relative;min-height:calc(100svh - 96px);overflow:hidden;color:#edf6ff;isolation:isolate;background:radial-gradient(ellipse 72% 68% at 50% 44%,rgba(43,91,147,.16),transparent 70%),radial-gradient(ellipse 44% 48% at 83% 70%,rgba(106,82,162,.15),transparent 73%)}.memory-room::before,.memory-room::after{position:absolute;inset:0;z-index:-1;content:"";pointer-events:none}.memory-room::before{background-image:radial-gradient(circle,rgba(211,231,255,.8) 0 1px,transparent 1.8px),radial-gradient(circle,rgba(172,207,246,.56) 0 1px,transparent 1.7px),radial-gradient(circle,rgba(255,255,255,.42) 0 .8px,transparent 1.6px),radial-gradient(circle,rgba(153,194,240,.45) 0 .9px,transparent 1.7px);background-size:137px 113px,211px 173px,89px 149px,269px 227px;background-position:0 0,42px 68px,18px 37px,94px 13px;opacity:.85}.memory-room::after{background:linear-gradient(90deg,rgba(4,14,30,.2),transparent 18%,transparent 82%,rgba(4,14,30,.22)),linear-gradient(0deg,rgba(3,12,26,.58),transparent 30%)}
.memory-room__back{position:absolute;z-index:5;top:28px;left:clamp(24px,4vw,72px);display:grid;place-items:center;width:40px;height:40px;border:1px solid rgba(202,227,250,.34);border-radius:50%;background:rgba(8,20,36,.22);color:#edf6ff;font-size:22px;text-decoration:none;backdrop-filter:blur(6px);transition:background .2s ease,transform .2s ease}.memory-room__back:hover,.memory-room__back:focus-visible{background:rgba(77,120,165,.35);outline:0;transform:translateX(-3px)}
.memory-room__viewport{position:absolute;inset:0;z-index:1;overflow:hidden;touch-action:pan-y;cursor:grab}.memory-room__viewport.is-dragging{cursor:grabbing}.memory-room__track{--memory-step:clamp(250px,27vw,390px);position:absolute;top:0;bottom:0;left:0;width:max(100%,calc(100vw + (var(--memory-count) - 1) * var(--memory-step)));will-change:transform;transform:translate3d(0,0,0);transition:none}.memory-room__track.is-dragging{transition:none}.memory-room__track::after{position:absolute;right:0;bottom:58px;left:0;height:1px;content:"";background:linear-gradient(90deg,transparent,rgba(193,218,242,.5) 5%,rgba(193,218,242,.42) 95%,transparent);box-shadow:0 0 18px rgba(138,190,237,.11)}
.memory-room__memory{--memory-card-h:clamp(104px,11vw,162px);--memory-rise:clamp(132px,19vh,230px);position:absolute;bottom:0;left:calc(50vw + var(--memory-index) * var(--memory-step));width:clamp(154px,18vw,270px);height:100%;transform:translateX(-50%)}.memory-room__memory:nth-child(3n+2){--memory-rise:clamp(210px,29vh,338px)}.memory-room__memory:nth-child(3n+3){--memory-rise:clamp(158px,23vh,272px)}.memory-room__stem{position:absolute;bottom:59px;left:50%;width:1px;height:var(--memory-rise);background:linear-gradient(0deg,rgba(209,231,252,.76),rgba(169,207,244,.28) 74%,transparent);transform:translateX(-50%)}.memory-room__stem::after{position:absolute;top:0;left:50%;width:7px;height:7px;border:1px solid rgba(221,239,255,.88);border-radius:50%;background:rgba(86,130,177,.78);box-shadow:0 0 0 5px rgba(134,190,242,.1);content:"";transform:translate(-50%,-50%)}.memory-room__image-button{position:absolute;bottom:calc(var(--memory-rise) + 58px);left:50%;display:block;width:100%;height:var(--memory-card-h);padding:0;border:1px solid rgba(220,237,255,.38);border-radius:12px;background:rgba(7,19,35,.34);box-shadow:0 14px 32px rgba(0,0,0,.26),inset 0 1px 0 rgba(255,255,255,.18);cursor:zoom-in;overflow:hidden;transform:translateX(-50%);transition:transform .25s cubic-bezier(.18,.83,.22,1),border-color .22s ease,box-shadow .22s ease}.memory-room__image-button::after{position:absolute;inset:0;content:"";background:linear-gradient(135deg,rgba(255,255,255,.12),transparent 38%,rgba(117,169,219,.12));pointer-events:none}.memory-room__image-button img{display:block;width:100%;height:100%;object-fit:cover;transition:transform .36s cubic-bezier(.2,.8,.2,1),filter .25s ease}.memory-room__memory:hover .memory-room__image-button,.memory-room__image-button:focus-visible{z-index:2;border-color:rgba(245,251,255,.92);box-shadow:0 18px 44px rgba(0,0,0,.34),0 0 0 5px rgba(174,213,250,.1);outline:0;transform:translateX(-50%) translateY(-6px) scale(1.08)}.memory-room__memory:hover .memory-room__image-button img,.memory-room__image-button:focus-visible img{transform:scale(1.06);filter:saturate(1.08) brightness(1.06)}
.memory-room__caption{position:absolute;bottom:calc(var(--memory-rise) + var(--memory-card-h) + 74px);left:50%;width:min(250px,calc(100vw - 48px));text-align:center;opacity:.5;transform:translate(-50%,6px);transition:opacity .22s ease,transform .22s ease;pointer-events:none}.memory-room__caption h1{margin:0;color:#f0f7ff;font-size:clamp(15px,1.35vw,20px);font-weight:620;letter-spacing:.06em;text-shadow:0 2px 15px rgba(0,0,0,.42)}.memory-room__caption p{max-height:0;margin:7px 0 0;overflow:hidden;color:rgba(222,236,250,.76);font-size:12px;line-height:1.5;opacity:0;transition:max-height .25s ease,opacity .2s ease}.memory-room__memory:hover .memory-room__caption{opacity:1;transform:translate(-50%,0)}.memory-room__memory:hover .memory-room__caption p{max-height:42px;opacity:1}.memory-room__time{position:absolute;bottom:0;left:50%;width:126px;text-align:center;transform:translateX(-50%);font:650 11px/1 ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:.12em;color:rgba(209,227,246,.7)}.memory-room__time i{display:block;width:9px;height:9px;margin:0 auto 14px;border:1px solid rgba(205,227,248,.78);border-radius:50%;background:rgba(14,34,57,.96);box-shadow:0 0 0 4px rgba(19,45,76,.72)}.memory-room__memory:hover .memory-room__time{color:#f5faff}.memory-room__memory:hover .memory-room__time i{background:#d7ebff;box-shadow:0 0 0 7px rgba(173,214,250,.12)}.memory-room__empty{position:absolute;top:50%;left:50%;margin:0;color:rgba(224,237,249,.72);transform:translate(-50%,-50%)}
.memory-lightbox{position:fixed;z-index:2147483001;inset:0;display:grid;place-items:center;padding:clamp(18px,4vw,64px);background:rgba(4,11,21,.5);backdrop-filter:blur(16px) saturate(110%);-webkit-backdrop-filter:blur(16px) saturate(110%)}.memory-lightbox[hidden]{display:none}.memory-lightbox__panel{position:relative;display:grid;grid-template-columns:minmax(0,1fr);gap:16px;max-width:min(960px,100%);max-height:100%;color:#edf6ff}.memory-lightbox__panel img{display:block;max-width:100%;max-height:calc(100svh - 170px);margin:auto;border-radius:13px;object-fit:contain;background:#071322;box-shadow:0 22px 70px rgba(0,0,0,.48)}.memory-lightbox__panel div{display:grid;grid-template-columns:100px 1fr;gap:7px 14px}.memory-lightbox__panel time{font:650 11px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:.13em;color:rgba(187,215,241,.72)}.memory-lightbox__panel h2{margin:0;font-size:23px;letter-spacing:.04em}.memory-lightbox__panel p{grid-column:2;margin:0;color:rgba(222,235,248,.78);line-height:1.65}.memory-lightbox__close{position:absolute;z-index:1;top:10px;right:10px;display:grid;place-items:center;width:36px;height:36px;border:1px solid rgba(232,244,255,.48);border-radius:50%;background:rgba(5,15,28,.62);color:#fff;font-size:23px;cursor:pointer}.memory-lightbox__close:hover,.memory-lightbox__close:focus-visible{background:rgba(87,133,181,.62);outline:0}
@media(max-width:760px){.memory-room{min-height:calc(100svh - 70px)}.memory-room__back{top:18px;left:18px;width:36px;height:36px}.memory-room__track{--memory-step:218px}.memory-room__memory{--memory-card-h:106px;--memory-rise:142px;width:156px}.memory-room__memory:nth-child(3n+2){--memory-rise:222px}.memory-room__memory:nth-child(3n+3){--memory-rise:170px}.memory-room__caption{bottom:calc(var(--memory-rise) + var(--memory-card-h) + 72px);width:188px}.memory-room__caption h1{font-size:14px}.memory-room__caption p{display:none}.memory-room__time{width:112px;font-size:10px}.memory-lightbox{padding:18px}.memory-lightbox__panel div{grid-template-columns:1fr;gap:7px}.memory-lightbox__panel p{grid-column:auto}.memory-lightbox__panel img{max-height:calc(100svh - 180px)}}
@media(prefers-reduced-motion:reduce){.memory-room__track,.memory-room__image-button,.memory-room__image-button img,.memory-room__caption{animation:none!important;transition:none!important}}

/* v2.1：轨道覆盖完整操作区；同月图片共用年月节点并沿支线向上错层。 */
body[data-page-section="friends"]:has(.memory-room) main.container,
.memory-room{min-height:100svh!important;height:100svh}.memory-room::before,.memory-room::after{z-index:0}.memory-room__viewport{z-index:1}.memory-room__back{z-index:2}.memory-room__memory{--memory-card-h:clamp(82px,8vw,122px);--memory-rise:clamp(118px,17vh,204px);--memory-stack-offset:calc(var(--memory-slot, 0) * clamp(68px,8vh,92px));width:clamp(118px,13vw,194px)}.memory-room__memory:nth-child(3n+2){--memory-rise:clamp(176px,25vh,286px)}.memory-room__memory:nth-child(3n+3){--memory-rise:clamp(136px,20vh,236px)}.memory-room__stem{height:calc(var(--memory-rise) + var(--memory-stack-offset))}.memory-room__image-button{bottom:calc(var(--memory-rise) + var(--memory-stack-offset) + 58px)}.memory-room__caption{bottom:calc(var(--memory-rise) + var(--memory-stack-offset) + var(--memory-card-h) + 74px)}
html[data-theme="light"] .memory-room{color:#1d3a58;background:radial-gradient(ellipse 72% 68% at 50% 44%,rgba(142,190,237,.34),transparent 70%),radial-gradient(ellipse 44% 48% at 83% 70%,rgba(196,178,229,.24),transparent 73%),#e7f0f8}html[data-theme="light"] .memory-room::before{opacity:.72}html[data-theme="light"] .memory-room::after{background:linear-gradient(90deg,rgba(227,240,250,.1),transparent 18%,transparent 82%,rgba(227,240,250,.14)),linear-gradient(0deg,rgba(146,181,216,.2),transparent 30%)}html[data-theme="light"] .memory-room__back{border-color:rgba(62,102,141,.3);background:rgba(241,248,253,.42);color:#1e4568}html[data-theme="light"] .memory-room__track::after{background:linear-gradient(90deg,transparent,rgba(75,126,169,.56) 5%,rgba(75,126,169,.44) 95%,transparent)}html[data-theme="light"] .memory-room__stem{background:linear-gradient(0deg,rgba(67,119,162,.68),rgba(105,151,191,.3) 74%,transparent)}html[data-theme="light"] .memory-room__caption h1{color:#1d4265;text-shadow:0 2px 14px rgba(255,255,255,.7)}html[data-theme="light"] .memory-room__caption p,html[data-theme="light"] .memory-room__time{color:rgba(35,76,113,.76)}html[data-theme="light"] .memory-room__time i{background:#edf7ff;border-color:rgba(53,103,145,.66);box-shadow:0 0 0 4px rgba(115,166,207,.2)}
@media(max-width:760px){.memory-room{min-height:100svh!important;height:100svh}.memory-room__memory{--memory-card-h:82px;--memory-rise:128px;--memory-stack-offset:calc(var(--memory-slot, 0) * 64px);width:124px}.memory-room__memory:nth-child(3n+2){--memory-rise:190px}.memory-room__memory:nth-child(3n+3){--memory-rise:148px}}

/* 回忆室是独立的全屏子房间：页头仅作悬浮控件，不占用星图操作区域。 */
body:has(.memory-room) .modern-site-header{position:absolute!important;inset:0 0 auto;z-index:10060!important}
body:has(.memory-room) main.container{margin:0!important}

/* 浅色模式仍保留满屏星点，避免成为无层次的单色背景。 */
html[data-theme="light"] .memory-room::before{background-image:radial-gradient(circle,rgba(56,103,154,.46) 0 1.05px,transparent 1.8px),radial-gradient(circle,rgba(98,147,192,.34) 0 .9px,transparent 1.6px),radial-gradient(circle,rgba(255,255,255,.9) 0 1.1px,transparent 1.85px),radial-gradient(circle,rgba(83,128,176,.26) 0 .8px,transparent 1.45px);background-size:108px 112px,174px 150px,238px 198px,322px 282px;background-position:12px 18px,66px 94px,132px 42px,26px 156px;opacity:.68}

/* 回忆室不参与页面纵向滚动；所有可操作区域都固定在真实视口内。 */
html:has(.memory-room),body:has(.memory-room){width:100%;height:100%;overflow:hidden!important}
body:has(.memory-room) main.container{position:fixed!important;inset:0!important;width:100vw!important;max-width:none!important;height:100dvh!important;min-height:100dvh!important;padding:0!important;overflow:hidden!important}
body:has(.memory-room) .memory-room{width:100vw!important;height:100dvh!important;min-height:100dvh!important}
body:has(.memory-room) .modern-site-header{position:fixed!important}

/* 返回入口避开左上角站点标识，始终位于稳定的页面操作位。 */
body:has(.memory-room) .memory-room__back{position:fixed!important;top:98px!important;left:28px!important;z-index:12010!important}
@media(max-width:760px){body:has(.memory-room) .memory-room__back{top:78px!important;left:16px!important}}

/* 标题沿图片右侧显示；只有图片本身可触发放大与预览效果。 */
.memory-room__memory{--memory-card-w:clamp(118px,13vw,194px);width:var(--memory-card-w)}
.memory-room__caption{bottom:calc(var(--memory-rise) + var(--memory-stack-offset) + 108px);left:calc(50% + var(--memory-card-w)/2 + clamp(12px,1.6vw,24px));width:min(220px,calc(50vw - 44px));text-align:left;opacity:.74;transform:translateY(50%)}
.memory-room__caption h1{font-size:clamp(14px,1.2vw,18px);line-height:1.35}.memory-room__caption p{margin-top:5px}
.memory-room__memory:hover .memory-room__image-button{z-index:auto;border-color:rgba(220,237,255,.38);box-shadow:0 14px 32px rgba(0,0,0,.26),inset 0 1px 0 rgba(255,255,255,.18);transform:translateX(-50%)}
.memory-room__memory:hover .memory-room__image-button img{transform:none;filter:none}
.memory-room__image-button:hover,.memory-room__image-button:focus-visible{z-index:2;border-color:rgba(245,251,255,.92);box-shadow:0 18px 44px rgba(0,0,0,.34),0 0 0 5px rgba(174,213,250,.1);outline:0;transform:translateX(-50%) translateY(-6px) scale(1.08)}
.memory-room__image-button:hover img,.memory-room__image-button:focus-visible img{transform:scale(1.06);filter:saturate(1.08) brightness(1.06)}
.memory-room__memory:hover .memory-room__caption{opacity:.74;transform:translateY(50%)}
.memory-room__memory:hover .memory-room__caption p{max-height:0;opacity:0}
.memory-room__image-button:hover + .memory-room__caption,.memory-room__image-button:focus-visible + .memory-room__caption{opacity:1;transform:translateY(calc(50% - 3px))}
.memory-room__image-button:hover + .memory-room__caption p,.memory-room__image-button:focus-visible + .memory-room__caption p{max-height:42px;opacity:1}
.memory-room__memory:hover .memory-room__time{color:rgba(209,227,246,.7)}.memory-room__memory:hover .memory-room__time i{background:rgba(14,34,57,.96);box-shadow:0 0 0 4px rgba(19,45,76,.72)}
.memory-room__image-button:hover ~ .memory-room__time,.memory-room__image-button:focus-visible ~ .memory-room__time{color:#f5faff}.memory-room__image-button:hover ~ .memory-room__time i,.memory-room__image-button:focus-visible ~ .memory-room__time i{background:#d7ebff;box-shadow:0 0 0 7px rgba(173,214,250,.12)}
@media(max-width:760px){.memory-room__memory{--memory-card-w:124px;width:var(--memory-card-w)}.memory-room__caption{left:calc(50% + var(--memory-card-w)/2 + 12px);width:min(138px,calc(50vw - 78px))}}

/* 透明纵向卡片不截获鼠标；只有可见图片按钮承担 hover 与点击。 */
.memory-room__viewport,.memory-room__track,.memory-room__memory,.memory-room__caption,.memory-room__time{user-select:none;-webkit-user-select:none}
.memory-room__memory{pointer-events:none}.memory-room__image-button{pointer-events:auto}.memory-room__image-button img{-webkit-user-drag:none;user-select:none}

/* 标题与说明均允许自然换行，长文本只在图片悬停时展开。 */
.memory-room__caption h1,.memory-room__caption p{overflow-wrap:anywhere;word-break:break-word}
.memory-room__caption h1{white-space:normal}.memory-room__caption p{line-height:1.55}
.memory-room__image-button:hover + .memory-room__caption p,.memory-room__image-button:focus-visible + .memory-room__caption p{max-height:8em}

/* 不以媒体断点隐藏简介：缩放触发窄布局时也完整换行显示。 */
.memory-room__caption{width:min(360px,calc(50vw - 142px))}
.memory-room__caption p{display:block!important;font-size:clamp(11px,.9vw,14px);line-height:1.6}
.memory-room__image-button:hover + .memory-room__caption p,.memory-room__image-button:focus-visible + .memory-room__caption p{max-height:none!important;overflow:visible;padding:6px 9px;border-radius:8px;background:linear-gradient(90deg,rgba(6,17,32,.72),rgba(6,17,32,.26));backdrop-filter:blur(5px)}

@media(max-width:640px){
  .memory-room__caption{bottom:calc(var(--memory-rise) + var(--memory-stack-offset) + var(--memory-card-h) + 76px);left:50%;width:min(260px,calc(100vw - 48px));text-align:center;transform:translate(-50%,6px)}
  .memory-room__memory:hover .memory-room__caption{transform:translate(-50%,6px)}
  .memory-room__image-button:hover + .memory-room__caption,.memory-room__image-button:focus-visible + .memory-room__caption{transform:translate(-50%,0)}
}

/* 悬停信息压在相邻卡片之上，长简介不会再被下一张图片截断。 */
.memory-room__memory:has(.memory-room__image-button:hover),.memory-room__memory:focus-within{z-index:12}
.memory-room__image-button:hover + .memory-room__caption,.memory-room__image-button:focus-visible + .memory-room__caption{z-index:13}
.memory-room__image-button:hover + .memory-room__caption p,.memory-room__image-button:focus-visible + .memory-room__caption p{position:relative;z-index:14}

/* 简介控制为短阅读行宽：完整显示，但不会在大屏变成过长的一行。 */
.memory-room__caption p{inline-size:min(16em,100%)}

/* Native modality, with the original full-viewport glass presentation. */
dialog.memory-lightbox{box-sizing:border-box;margin:0;width:100%;height:100%;max-width:none;max-height:none;border:0;color:inherit}
dialog.memory-lightbox::backdrop{background:transparent}
dialog.memory-lightbox:not([open]){display:none}

/* 同日卡片共用一个起点，以实际图片高度加留白向上排列。保留各日期间的高低错位。 */
.memory-room__memory:nth-child(n){--memory-rise:clamp(118px,17vh,204px);--memory-stack-offset:calc(var(--memory-slot,0) * (var(--memory-card-h) + 28px))}
.memory-room__memory[data-memory-lane="1"]{--memory-rise:clamp(176px,25vh,286px)}
.memory-room__memory[data-memory-lane="2"]{--memory-rise:clamp(136px,20vh,236px)}
.memory-room__viewport{overflow-y:auto;overscroll-behavior-y:contain;touch-action:pan-y pinch-zoom}
.memory-room__caption{bottom:calc(var(--memory-rise) + var(--memory-stack-offset) + 58px + var(--memory-card-h)/2)}
@media(max-width:760px){
  .memory-room__memory:nth-child(n){--memory-rise:128px}
  .memory-room__memory[data-memory-lane="1"]{--memory-rise:190px}
  .memory-room__memory[data-memory-lane="2"]{--memory-rise:148px}
}
@media(max-width:640px){
  .memory-room__memory:nth-child(n){--memory-stack-offset:calc(var(--memory-slot,0) * (var(--memory-card-h) + 76px))}
  .memory-room__caption{bottom:calc(var(--memory-rise) + var(--memory-stack-offset) + var(--memory-card-h) + 76px)}
}
