/* Touch layout owns the compact screen composition, not a scaled desktop canvas. */
.friends-constellation__zoom{display:none}
.friends-constellation__zoom[hidden]{display:none!important}
@media (max-width:980px){
  /* 浏览器底栏收起的区域延续当前场景，不能用全站固定黑底替代。 */
  html{--touch-dock:76px;scroll-padding-top:76px;scroll-padding-bottom:90px;scroll-behavior:auto;background:var(--mobile-scene-base,#0d1728)!important;}
  html,html body{overflow-x:clip}
  html body :is(input,textarea,select){font-size:16px}
  html:root.has-fixed-mobile-nav body{padding-top:0!important}
  html body{min-height:100dvh!important;padding-bottom:calc(var(--touch-dock) + env(safe-area-inset-bottom))!important;background-color:var(--mobile-scene-base,#0d1728)!important}
  /* 背景/幕布覆盖底栏完全隐藏后的最大视口；控件继续使用实际可见视口。
     不用 JS 在每次 visualViewport resize 时写高度，避免拖动期间反复布局。 */
  html body:is([data-page-kind="home"],[data-page-section="posts"],[data-page-section="friends"],[data-page-layout="site-notice"]) .site-bg-layer{
    height:100vh!important;height:100lvh!important;--site-bg-height:100lvh!important;
  }
  html .site-boot-overlay,html.document-cover::after{
    height:100vh!important;height:100lvh!important;
  }
  /* 共用玻璃顶栏，只在这里调整紧凑视口的排布。 */
  html.has-fixed-mobile-nav body .modern-site-header .modern-navbar,
  html body .modern-site-header .modern-navbar{width:100%!important;max-width:none!important;height:60px!important;min-height:60px!important;box-sizing:border-box;padding:8px 14px!important;margin:0!important;border:0!important;border-radius:0!important;box-shadow:none!important;flex-wrap:nowrap!important;background:transparent!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
  /* 浅色移动端不再沿用旧系统接近纯白的 --border；玻璃靠色块区分，不靠亮边框切割。 */
  html body:not(.dark){--border:rgba(102,83,92,.24)!important}
  html body:not(.dark) :is(.card,.area-card,.page-hero,.content-archive,.archive-record__drawer-shell,.article-shell,.article-intro,.article-reader,.tools-search-station,.tool-card,.typing-panel,.typing-card){border-color:transparent!important}
  html body:not(.dark) .content-archive{box-shadow:0 22px 55px rgba(54,37,42,.12)!important}
  html body:not(.dark) :is(.songline-terminal-stats,.songline-terminal-stat-grid,.songline-home-music,.songline-terminal-links){border-color:rgba(246,224,216,.13)!important}
  html body .modern-site-header .header-icons{gap:4px!important}
  html body .modern-site-header .icon-btn{width:42px!important;height:42px!important}
  html:root body main.container{width:100%!important;max-width:none!important;margin:0!important;padding:80px 14px 24px!important;box-sizing:border-box}
  /* 工具内页的高优先级 padding:0 曾把返回键压到固定顶栏下，触屏无法点击。 */
  html:root body[data-page-section="tools"]:not([data-page-layout="tools"]) main.container{padding:80px 14px 24px!important}
  html:root body[data-page-section="posts"] main.container:has(.content-archive){width:100%!important;padding:80px 14px 24px!important}
  html body[data-page-kind="home"] .songline-home-layout{display:block!important;width:100%!important;margin:0!important;padding:30px 0 0!important}
  html body[data-page-kind="home"] .songline-home-main{display:none!important}
  html body[data-page-kind="home"] .songline-home-system{width:100%!important;max-width:640px!important;margin:0 auto!important;padding:0!important;border:0!important;transform:none!important}
  html body[data-page-kind="home"] .songline-terminal-frame{min-height:0!important;width:100%!important;padding:18px!important;transform:none!important;border-radius:18px;background:rgba(9,25,45,.7)}
  html body[data-page-kind="home"] .songline-terminal-main{grid-template-columns:1fr!important;gap:16px!important}
  html body[data-page-kind="home"] .songline-terminal-feature-stage{height:auto!important;min-height:0!important;aspect-ratio:16/9}
  html body[data-page-kind="home"] .songline-terminal-feature-copy{padding:12px!important}
  html body[data-page-kind="home"] .songline-terminal-feature-copy strong{font-size:20px!important;line-height:1.3}
  html body[data-page-kind="home"] .songline-terminal-stats{padding:16px 0 0!important}
  html body[data-page-kind="home"] .songline-terminal-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  html body[data-page-kind="home"] .songline-terminal-stat-grid .songline-terminal-stat{min-height:70px!important;padding:8px!important}
  html body[data-page-kind="home"] .songline-terminal-stat-grid .songline-terminal-stat-label{font-size:12px!important}
  html body[data-page-kind="home"] .songline-terminal-stat-grid .songline-terminal-stat-value{font-size:25px!important}
  html body[data-page-kind="home"] .songline-home-music-actions button{min-width:40px;min-height:44px}
  html body[data-page-kind="home"] .songline-terminal-links{align-items:center;flex-wrap:wrap;gap:12px;min-height:44px;padding:12px 0 0!important}
  html body[data-page-kind="home"] .songline-desktop-pet{top:auto!important;bottom:0;right:0!important;width:76px!important;height:92px!important;touch-action:none}
  html:root body[data-page-kind="home"] .songline-terminal-status .songline-desktop-pet__image{left:0!important;width:72px!important;height:78px!important}
  /* 品牌名按终端整体中心定位；摆件和在线信息各有独立定位，不再参与标题排版。 */
  html body[data-page-kind="home"] .songline-terminal-status{display:block!important;min-height:92px!important;padding:0!important;box-sizing:border-box}
  html body[data-page-kind="home"] .songline-terminal-status .songline-terminal-brand{position:absolute!important;z-index:1!important;top:4px!important;right:0!important;left:0!important;max-width:none!important;margin:0!important;font-size:26px!important;line-height:1.08!important;text-align:center!important;white-space:nowrap!important;transform:none!important}
  html body[data-page-kind="home"] .songline-terminal-live{position:absolute!important;right:84px!important;bottom:10px!important;left:0!important;display:flex!important;width:auto!important;margin:0!important;padding:0!important}
  html body[data-page-kind="home"] .songline-terminal-copy-tip{top:auto!important;right:auto!important;bottom:calc(100% + 8px)!important;left:0!important;transform:translateY(4px)!important}
  html body[data-page-kind="home"] .songline-terminal-copy-tip.is-visible{transform:translateY(0)!important}
  html body[data-page-kind="home"] .songline-home-music{display:block!important;padding-top:12px!important;min-height:0!important}
  html body[data-page-kind="home"] .songline-home-music-main{display:block!important}
  html body[data-page-kind="home"] .songline-home-music-track strong{font-size:15px}
  html body[data-page-kind="home"] .songline-home-music-spectrum{position:relative!important;inset:auto!important;width:100%;height:30px!important;margin:8px 0!important;transform:none!important}
  html body[data-page-kind="home"] .songline-home-music-actions{display:flex!important;justify-content:space-between;transform:none!important;margin:0!important;gap:2px}
  html body[data-page-kind="home"] .songline-home-music-actions .ui-icon{--ui-icon-size:18px}
  html body[data-page-kind="home"] .songline-home-music-status{position:static!important;margin:6px 0!important}
  /* Mobile panels participate in document flow: a swipe never gets trapped in a tiny list. */
  html body[data-page-kind="home"] .songline-home-message-board{display:none;position:relative;inset:auto;min-height:0;padding:14px;grid-template-rows:auto auto auto}
  html body[data-page-kind="home"] [data-home-panel-state="message"] .songline-home-system-panel,
  html body[data-page-kind="home"] [data-home-panel-state="compose"] .songline-home-system-panel{display:none}
  html body[data-page-kind="home"] [data-home-panel-state="message"] .songline-home-message-board,
  html body[data-page-kind="home"] [data-home-panel-state="compose"] .songline-home-message-board{display:grid;animation:touch-panel-enter .22s ease-out}
  html body[data-page-kind="home"] .songline-home-message-scroll{overflow:visible;max-height:none;overscroll-behavior:auto;padding-inline:0}
  html body[data-page-kind="home"] .songline-home-message-compose{position:relative;inset:auto;padding:12px;margin-top:12px;min-width:0}
  html body[data-page-kind="home"] [data-home-panel-state="compose"] :is(.songline-home-message-scroll,.songline-home-message-footer){display:none}
  html body[data-page-kind="home"] .songline-home-message-board button{min-height:44px;min-width:44px}
  html body[data-page-kind="home"] .songline-home-message-head{gap:10px}
  html body[data-page-kind="home"] .songline-home-message-compose textarea{min-height:160px}
  html body .content-archive{width:100%!important;max-width:none!important;margin:0!important;padding:16px 12px!important;box-sizing:border-box}
  html body .content-archive .content-archive__controls{gap:8px}
  html body .content-archive .content-archive__mode,html body .content-archive .content-archive__search-trigger{font-size:18px;min-height:48px;padding:8px;gap:6px}
  html body .content-archive__mode b{display:none}
  html body .content-archive .content-archive__search-terms{overscroll-behavior-y:auto;scroll-snap-type:none;max-height:150px;mask-image:none;-webkit-mask-image:none}
  html body .content-archive__search-terms button{min-height:40px}
  html body .archive-record__index{grid-template-columns:28px minmax(0,1fr) 20px!important;gap:8px!important;min-height:78px!important;padding:16px 0!important}
  html body .archive-record__index time{display:none}
  html body .archive-record__title{font-size:18px!important;line-height:1.5!important;white-space:normal!important;overflow-wrap:anywhere}
  html body .archive-record__drawer-content{grid-template-columns:minmax(0,1fr)!important;padding:12px 0!important;gap:14px!important}
  html body .archive-record__cover{width:100%!important;max-width:100%!important;aspect-ratio:16/9}
  html body .archive-record__detail{padding:0!important;min-width:0}
  html body .archive-record__detail h2{font-size:22px!important}
  html body[data-page-layout="tools"] .tools-grid{grid-template-columns:minmax(0,1fr)!important;width:100%!important;gap:12px!important;margin:22px 0 0!important;padding:0!important}
  html body[data-page-layout="tools"] .tools-grid .tool-card{width:100%!important;min-height:92px!important;margin:0!important;padding:16px 42px 16px 10px!important;display:grid!important;grid-template-columns:52px minmax(0,1fr)!important;gap:12px!important;box-sizing:border-box}
  html body[data-page-layout="tools"] .tool-card h2{font-size:18px!important;line-height:1.4!important}
  html body[data-page-layout="tools"] .tool-card p{font-size:13px!important;line-height:1.5!important}
  html body[data-page-layout="tools"] .tool-card-arrow{position:absolute!important;right:10px!important;top:50%!important;margin:0!important;transform:translateY(-50%)!important}
  html body[data-page-layout="tools"] .tools-searchbox{margin:10px 0 0!important;width:100%!important}
  html body[data-page-layout="tools"] .tool-node-connector{display:none!important}
  html:root body[data-page-layout="tools"] .tools-excavation{padding:24px 0!important}
  html:root body[data-page-layout="tools"] .tools-search-station{width:100%;box-sizing:border-box;margin-bottom:20px}
  html:root body[data-page-layout="tools"] .tools-searchbox{font-size:16px!important;min-height:44px!important}
  html:root body[data-page-layout="tools"] .tools-search-row{grid-template-columns:minmax(0,1fr) 44px!important}
  html:root body[data-page-layout="tools"] .tools-search-row .tools-searchbox{grid-column:1!important;grid-row:1!important;margin:0!important}
  html:root body[data-page-layout="tools"] .tools-search-row .search-submit{grid-column:2!important;grid-row:1!important;min-height:44px}
  html:root body[data-page-layout="tools"] .tools-search-row .search-count{grid-column:1/-1!important;grid-row:2!important}
  html:root body[data-page-layout="tools"] .tools-strata{width:100%;min-height:0;margin:0;padding:0}
  html:root body[data-page-layout="tools"] .tools-strata-nodes{width:100%;min-height:0;grid-template-columns:minmax(0,1fr);gap:8px}
  html:root body[data-page-layout="tools"] .tools-grid .tools-strata-nodes .tool-card[data-tool-side]{grid-column:1;transform:none;justify-self:stretch}
  html:root body[data-page-layout="tools"] :is(.tools-strata-axis,.tools-strata-root){display:none}
  html body:has(.memory-room) main.container,html body:has(.friends-constellation) main.container{position:fixed!important;inset:60px 0 calc(76px + env(safe-area-inset-bottom))!important;width:100%!important;height:auto!important;min-height:0!important;padding:0!important}
  html body .memory-room,html body .friends-constellation,html body .friends-constellation__sky{width:100%!important;height:100%!important;min-height:0!important}
  html:root body:has(.memory-room) .memory-room{width:100%!important;height:100%!important;min-height:0!important}
  html:root body:has(.memory-room) .memory-room__back{position:absolute!important;top:12px!important;left:12px!important}
  html body .memory-room__back{top:12px!important;left:12px!important;width:44px;height:44px}
  html body .friends-constellation__memory-door{right:8px!important;padding:10px!important;min-height:44px}
  html body .friends-constellation__zoom{position:absolute;z-index:15;right:12px;bottom:12px;display:flex;gap:4px;padding:4px;border-radius:14px;background:rgba(12,25,43,.85)}
  html body .friends-constellation__zoom button{width:44px;height:44px;padding:0;border:0;border-radius:10px;background:transparent;color:#edf6ff;font-size:24px;touch-action:manipulation}
  html body .friends-constellation__zoom button:is(:hover,:focus-visible){background:rgba(173,198,226,.2)}
  html body .friends-constellation__zoom button:disabled{opacity:.35}
  /* 拖动时也保留外缘柔焦：它是星图空间感的一部分，不应因手势而闪退。 */
  html body .friends-constellation__sky.is-dragging .friends-constellation__edge-vignette{opacity:1!important}
  html body .memory-room__viewport{overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:contain;touch-action:pan-y pinch-zoom}
  html body .memory-room__track{position:relative;top:auto;bottom:auto;height:max(100%,var(--memory-mobile-height,100%))}
  html body .memory-room__memory:nth-child(n){--memory-rise:48px;--memory-stack-offset:calc(var(--memory-slot,0) * 148px);--memory-card-h:92px;--memory-card-w:138px}
  html body .memory-room__caption{bottom:calc(var(--memory-rise) + var(--memory-stack-offset) + var(--memory-card-h) + 68px);left:50%;width:190px;text-align:center;transform:translateX(-50%)}
  html body .memory-room__memory:hover .memory-room__caption,html body .memory-room__image-button:is(:hover,:focus-visible) + .memory-room__caption{transform:translateX(-50%)}
  html body .memory-room__caption h1{font-size:14px;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  html body .memory-room__caption p{display:none!important}
  html body .memory-room__image-button:is(:hover,:focus-visible){transform:translateX(-50%)}
  html body .memory-lightbox__panel{width:calc(100vw - 24px)!important;max-height:calc(100dvh - 24px)!important;overflow:auto}
  html body .memory-lightbox__panel img{max-height:60dvh;object-fit:contain}
  html body .article-shell{width:100%!important;max-width:none!important;display:block!important;padding:8px!important;box-sizing:border-box}
  html body .article-reader{padding:18px 14px!important;min-width:0!important}
  html body .article-intro h1{font-size:30px!important;line-height:1.25!important;overflow-wrap:anywhere}
  html body .markdown-body{font-size:16px!important;line-height:1.85!important;overflow-wrap:anywhere}
  html body .markdown-body pre,html body .markdown-body table{max-width:100%;overflow:auto}
  html body .article-toc{display:none!important}
  html:root body > .scroll-to-bottom-button[data-songline-float-portal]{bottom:calc(88px + env(safe-area-inset-bottom))!important}
  html:root body > .mobile-toc-fab{bottom:calc(140px + env(safe-area-inset-bottom))!important}
  html:root body > .back-to-top-button[data-songline-float-portal]{bottom:calc(192px + env(safe-area-inset-bottom))!important}
  html:root body > .mobile-toc-drawer{bottom:calc(86px + env(safe-area-inset-bottom))!important;max-height:calc(100dvh - 162px)!important}
  html:root.mobile-toc-open body > [data-songline-float-portal]{visibility:hidden!important}

  /* 首页内容保留自己的暖灰终端层；顶栏已在上方全站统一，不再单独覆盖。 */
  html body:not(.dark)[data-page-kind="home"] .songline-terminal-frame{
    color:rgba(255,249,246,.96)!important;
    background:linear-gradient(135deg,rgba(58,58,73,.58),rgba(91,70,80,.40))!important;
    border:1px solid rgba(243,217,206,.20)!important;
    box-shadow:0 16px 38px rgba(64,44,48,.14)!important;
    backdrop-filter:blur(13px) saturate(104%)!important;
    -webkit-backdrop-filter:blur(13px) saturate(104%)!important;
  }
  html body:not(.dark)[data-page-kind="home"] .songline-terminal-frame::before{
    border-left-color:rgba(245,221,211,.22)!important;
    background:linear-gradient(90deg,rgba(246,211,191,.48),rgba(246,211,191,.48)) left top / 58px 1px no-repeat,linear-gradient(90deg,rgba(235,219,222,.28),rgba(235,219,222,.28)) right bottom / 58px 1px no-repeat!important;
    opacity:.64!important;
  }
  html body:not(.dark)[data-page-kind="home"] .songline-terminal-frame::after{background:rgba(244,220,213,.28)!important;box-shadow:6px 8px 0 -.5px rgba(219,172,152,.30)!important}
  html body:not(.dark)[data-page-kind="home"] .songline-terminal-status,
  html body:not(.dark)[data-page-kind="home"] .songline-terminal-links{border-color:rgba(246,224,216,.22)!important}
  html body:not(.dark)[data-page-kind="home"] .site-bg-layer::before{background-position:20% center!important;transform:scale(1.004)!important}
  html body:not(.dark)[data-page-kind="home"] .site-bg-layer::after{background:linear-gradient(180deg,rgba(38,40,52,.04) 28%,rgba(41,37,48,.22) 100%)!important}

  /* 两个主题共用同一张移动取景框，主题切换不会让背景横向跳位。 */
  html body.dark[data-page-kind="home"] .site-bg-layer::before{background-position:20% center!important;transform:scale(1.004)!important}
}
@keyframes touch-panel-enter{from{opacity:0;translate:0 8px}to{opacity:1;translate:0 0}}
@media(prefers-reduced-motion:reduce){html body[data-page-kind="home"] .songline-home-message-board{animation:none!important}}
