/* The gallery lets pointer input pass through the desktop. A visible reader
   remains an interactive window inside that container. */
body .reader-window{pointer-events:auto}

/* Visible appearance controls are part of the workspace chrome, above readers. */
#appearance-toolbar{position:fixed;z-index:31;top:88px;left:20px;right:20px;height:44px;display:flex;align-items:center;gap:14px;padding:3px 12px;border:1px solid var(--ws-line);border-radius:12px;background:var(--ws-panel);color:var(--ws-ink);box-shadow:0 3px 14px #0002;overflow-x:auto;scrollbar-width:thin}
#appearance-toolbar button,#appearance-toolbar select{color:var(--ws-ink);background:var(--ws-soft);border:1px solid var(--ws-line);border-radius:6px;min-height:30px;font-size:13px;font-weight:600;padding:3px 8px}
#appearance-toolbar .appearance-palette-button{white-space:nowrap;font-weight:750}#appearance-toolbar label{margin:0;flex-shrink:0}.appearance-choice{display:flex;align-items:center;gap:7px;font-size:12px;font-weight:650}.appearance-choice select{width:140px}.appearance-contrast{display:flex;flex-direction:column;gap:0;min-width:260px;font-size:11px;font-weight:650}.appearance-contrast output{margin-left:8px;color:var(--ws-muted)}.appearance-range{display:flex;align-items:center;gap:8px;font-size:10px}.appearance-range input{width:180px;min-width:100px;accent-color:var(--ws-accent);margin:0;flex:1}.appearance-range>span{color:var(--ws-muted)}#quick-clear{margin-left:auto}
body .desktop{top:140px}body .desktop-heading,body[data-spatial-view=explore] .desktop-heading{height:48px!important;padding:0 5px!important}body .desktop-heading .hero-intro .eyebrow,body .desktop-heading .hero-intro>p:last-child{display:none}body .desktop-heading .hero-intro h1{font-size:24px!important;margin:0}body .library-window{top:48px!important}body .reader-window{min-height:0}
.wallpaper:after{content:'';position:absolute;inset:0;background:var(--scene-backdrop-shield,transparent);pointer-events:none}html.three-spatial-ready body:not(.graphics-recovering) .wallpaper:after{display:none}
@media(max-width:1100px){#appearance-toolbar{gap:9px}.appearance-choice{flex-direction:column;gap:0;align-items:flex-start;font-size:9px}.appearance-choice select{min-height:26px!important;font-size:12px!important;width:124px}.appearance-contrast{min-width:220px}}
@media(max-width:760px){#appearance-toolbar{top:72px;left:10px;right:10px;gap:9px;padding:3px 8px}#appearance-toolbar .appearance-palette-button{font-size:12px;min-width:108px}.appearance-contrast{min-width:210px}body .desktop,body[data-spatial-view=explore] .desktop{top:128px}body .reader-window{top:128px!important}body .desktop-heading{display:none!important}body .library-window,body[data-spatial-view=explore] .library-window{top:0!important}}
@media(max-height:500px){body .desktop-heading{display:none!important}body .library-window,body[data-spatial-view=explore] .library-window{top:0!important}}
@media(forced-colors:active){#appearance-toolbar,#appearance-toolbar button,#appearance-toolbar select{color:CanvasText;background:Canvas;border-color:CanvasText}}
@media print{#appearance-toolbar{display:none!important}}


/* Public reader, discovery filters and dock retain their complete native controls. */
body .reader-window{top:188px;bottom:86px}body .desktop-heading .hero-intro h1{font-size:24px!important}body .menu-end .icon-button{min-width:36px;height:36px}body .nav-item{color:var(--ws-ink);font-size:14px;min-height:44px}body .hero-copy p{font-size:14px;line-height:1.7}body .filter-field{font-size:12px}body .article-index-meta{color:var(--ws-muted)}
@media(max-width:760px){body .reader-window{top:128px!important;bottom:76px!important}body .dock{max-width:calc(100vw - 124px);overflow-x:auto}body .dock-item{flex-shrink:0}body .menubar{height:52px}body .desktop{bottom:76px}body[data-spatial-view=explore] .desktop{bottom:38vh}body .hero-intro h1{font-size:22px!important}}
@media(min-width:480px) and (max-width:760px) and (max-height:500px){body[data-spatial-view=explore] .desktop{width:calc(52vw - 20px);left:10px;right:auto;top:128px;bottom:76px}body[data-spatial-view=explore] .sidebar{display:none}}
@media print{body .reader-window{top:auto!important;bottom:auto!important}}

/* V67: the current renderer owns canvas readiness. Reveal its glass relief and
   background together after its first successful frame, including still mode. */
html.three-spatial-ready body:not(.graphics-recovering) #svgn-glass-canvas{opacity:1;transition:none}
html:not(.three-spatial-ready) #svgn-glass-canvas,
body.graphics-recovering #svgn-glass-canvas{opacity:0;transition:none}
@media(forced-colors:active){#svgn-glass-canvas{display:none!important}}
@media print{#svgn-glass-canvas{display:none!important}}

/* A foreground reader owns its controls. Preserve scenery transparency in the
   article, while removing the library and its title bar from underneath it. */
@media screen{
 body:has(#reader:not([hidden])) .library-window{display:none!important}
 body:has(#reader:not([hidden])) .desktop-heading{visibility:hidden}
 body .reader-window{left:20px;top:140px}
}
body #reader>.reader-titlebar{background:linear-gradient(var(--ws-soft),var(--ws-soft)),var(--ws-bg)!important}

/* V68: the scrolling list fills its window instead of the legacy 640/700px cap. */
body .library-window{min-height:0}
body .library-window .library-body{max-height:none}
/* Keep the topic list in the sidebar's own scroll flow. */
body .sidebar>*{flex-shrink:0}
.sidebar-topics{margin:18px 0 10px;border-top:1px solid var(--ws-line);padding-top:12px}
.sidebar-topics summary{cursor:pointer;padding:8px 6px;font-size:14px;font-weight:750;color:var(--ws-ink)}
.sidebar-topics nav{display:flex;flex-direction:column;gap:3px;margin-top:6px}
.sidebar-topic{display:flex;align-items:center;gap:8px;padding:9px 8px;min-height:40px;border:1px solid transparent;border-radius:7px;text-decoration:none;color:var(--ws-ink);font-size:13px;line-height:1.4;font-weight:600}
.sidebar-topic>span:first-child{min-width:0;overflow-wrap:anywhere}
.sidebar-topic:hover,.sidebar-topic.active{background:var(--ws-soft);border-color:var(--ws-line)}
.sidebar-topic.active{color:var(--ws-accent)}
.topic-count{margin-left:auto;flex-shrink:0;font-size:11px;font-variant-numeric:tabular-nums;color:var(--ws-muted)}
/* Only the scrolling paper gets alpha. Parent layers must not mask that alpha.
   Titlebar keeps V67's fully backed controls, independently of the paper. */
body #reader{background:transparent!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
body #reader>.reader-split{background:transparent!important}
body #reader #article-scroll{background:var(--article-paper,var(--ws-panel))!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
body #reader>.reader-titlebar{height:auto;min-height:48px;flex-shrink:0;flex-wrap:wrap;gap:5px 10px;padding-block:5px}
body #reader .reader-tools{max-width:100%;min-width:0;flex-wrap:wrap;justify-content:flex-end;gap:5px}
.article-transparency{display:flex;flex-direction:column;justify-content:center;gap:1px;margin:0 8px 0 0;min-width:150px;color:var(--ws-ink);font:600 11px/1.4 ui-sans-serif,system-ui,sans-serif;cursor:default}
.article-transparency span{display:flex;justify-content:space-between;gap:8px}
.article-transparency output{font-variant-numeric:tabular-nums;min-width:30px;text-align:right}
.article-transparency input{width:150px;max-width:100%;min-height:22px;margin:0;accent-color:var(--ws-accent);cursor:pointer}
@media(max-width:760px){
 body .sidebar-topics{padding-top:4px;margin-top:9px}
 body .sidebar-topics summary{font-size:10px;padding:7px 0;list-style:none;text-align:center;border:1px solid var(--ws-line);border-radius:6px}
 body .library-window .sidebar:has(.sidebar-topics[open]){flex-basis:180px!important;width:180px!important}
 body .sidebar:has(.sidebar-topics[open]) .sidebar-topics summary{font-size:13px;text-align:left;padding-left:8px}
 body .sidebar-topics:not([open]) nav{display:none}
 body #reader>.reader-titlebar>.window-mark{display:none}
 body #reader .reader-tools{width:100%}
 .article-transparency{flex-basis:100%;align-items:stretch;margin:0 0 3px}.article-transparency input{width:100%}
}
@media(forced-colors:active){body #reader #article-scroll{background:Canvas!important;color:CanvasText}.sidebar-topic.active{outline:2px solid Highlight}.article-transparency input{forced-color-adjust:auto}}
@media print{body #reader #article-scroll{background:white!important;color:black!important}}


/* V70: each chrome row has its own space; measured insets follow wrapping. */
:root{--svgn-toolbar-top:116px;--svgn-content-top:184px;--svgn-dock-height:62px;--svgn-bottom-clearance:134px}
@media screen{
 body .menubar{top:8px;left:12px;right:12px;height:52px;gap:12px;padding:0 12px;box-sizing:border-box}
 body .menubar .brand{flex:0 0 auto}
 body .menubar .top-search{display:flex;flex:0 1 280px;width:auto!important;min-width:90px;height:40px;padding:0 10px!important;gap:8px;white-space:nowrap;overflow:hidden;justify-content:flex-start}
 body .menubar .top-search span{display:inline;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 body .menubar .top-search::after{content:none;display:none}
 body .menubar .top-search kbd{display:inline;white-space:nowrap;flex:0 0 auto;margin-left:auto}
 body .menubar .menu-end{flex:0 0 auto;gap:6px}
 body .menubar .menu-end .icon-button,body .menubar .sidebar-toggle{width:40px;min-width:40px;height:44px;min-height:44px;padding:8px;flex:0 0 40px}
 body .menubar .sidebar-toggle{display:none}
 body .news-ticker{position:fixed;top:66px;left:12px;right:12px;z-index:29;box-sizing:border-box;display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:8px;height:44px;min-height:44px;margin:0;padding:0 10px;border:1px solid var(--ws-line);border-radius:12px;overflow:hidden;transform:none}
 body .news-ticker .ticker-story{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 body .news-ticker .ticker-controls{display:flex;gap:0;min-width:0}
 body .news-ticker .ticker-controls .icon-button{width:40px;min-width:40px;height:42px;min-height:42px;padding:8px}
 body #appearance-toolbar{top:var(--svgn-toolbar-top);left:12px;right:12px;display:grid;grid-template-columns:auto minmax(120px,1fr) minmax(140px,1.2fr) minmax(220px,1.5fr) auto;align-items:center;gap:8px;height:auto;min-height:52px;box-sizing:border-box;padding:6px 10px;overflow:visible;white-space:normal}
 body #appearance-toolbar .appearance-choice{display:flex;flex-direction:column;align-items:stretch;gap:2px;min-width:0;font-size:10px}
 body #appearance-toolbar .appearance-choice select{width:100%!important;min-width:0;max-width:100%;min-height:30px;box-sizing:border-box;font-size:12px!important}
 body #appearance-toolbar .appearance-contrast{display:flex;flex-direction:column;min-width:0;width:auto;gap:2px}
 body #appearance-toolbar .appearance-range{display:flex;min-width:0;width:100%;gap:5px}
 body #appearance-toolbar .appearance-range input{width:0;min-width:40px;flex:1 1 0}
 body #appearance-toolbar .appearance-range span{flex:0 0 auto}
 body #appearance-toolbar button{min-height:36px;white-space:nowrap}
 body .desktop,body[data-spatial-view="explore"] .desktop{top:var(--svgn-content-top);bottom:calc(var(--svgn-bottom-clearance) + env(safe-area-inset-bottom,0px));left:12px;right:12px}
 body .desktop-heading{height:48px!important}
 body .library-window{top:48px!important}
 body #reader.reader-window{top:var(--svgn-content-top);bottom:calc(var(--svgn-bottom-clearance) + env(safe-area-inset-bottom,0px));left:12px;right:12px;max-width:none;min-width:0;max-height:none}
 body .dock,body.relief-ready .dock[data-liquid-owner],body.graphics-recovering .dock[data-liquid-owner],html.svgn-review-locked body .dock[data-liquid-owner]{left:12px!important;right:12px!important;bottom:calc(8px + env(safe-area-inset-bottom,0px))!important;transform:var(--liquid-matrix,none)!important;width:auto;max-width:700px;min-width:0;height:auto;min-height:62px;margin:0 auto;box-sizing:border-box;padding:5px!important;display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px!important;overflow:visible;z-index:35}
 body .dock .dock-divider{display:none}
 body .dock .dock-item{display:flex;flex-direction:column;justify-content:center;align-items:center;min-width:0;min-height:50px;padding:4px 2px!important;gap:2px;font-size:11px!important;white-space:nowrap}
 body .dock .dock-item .dock-icon{width:24px;height:24px}
 body #spatial-hud{left:12px!important;right:12px!important;bottom:calc(var(--svgn-dock-height) + 16px + env(safe-area-inset-bottom,0px))!important;width:auto;max-width:430px;margin:0 auto;z-index:35}
 body #spatial-hud .spatial-view-controls{display:grid;grid-template-columns:1fr 1.2fr auto;gap:3px;padding:3px;box-sizing:border-box}
 body #spatial-hud .spatial-view-controls button{display:flex;justify-content:center;align-items:center;gap:5px;min-width:0;min-height:38px;padding:6px;font-size:11px!important;white-space:nowrap}
 body #spatial-hud .spatial-view-controls button span{display:inline;font-size:11px!important}
 body #spatial-hud [data-spatial-view="explore"] span::after{content:none}
 body .sidebar-navigation-dialog{position:fixed;inset:12px auto 12px 12px;box-sizing:border-box;width:min(340px,calc(100vw - 24px));height:calc(100dvh - 24px);max-height:calc(100dvh - 24px);max-width:calc(100vw - 24px);margin:0;padding:0;border:1px solid var(--ws-line);border-radius:16px;background:var(--ws-panel);color:var(--ws-ink);overflow:hidden}
 body .sidebar-navigation-dialog[open]{display:flex;flex-direction:column}
 body .sidebar-navigation-dialog::backdrop{background:rgba(6,12,22,.5);backdrop-filter:blur(4px)}
 body .sidebar-navigation-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 14px;flex:0 0 auto;border-bottom:1px solid var(--ws-line)}
 body .sidebar-navigation-header h2{font-size:17px;margin:0}
 body .sidebar-navigation-header button{width:44px;height:44px;font-size:26px}
 body .sidebar-navigation-body{min-height:0;flex:1;overflow:auto}
 body .sidebar-navigation-dialog .sidebar{display:flex!important;box-sizing:border-box;flex:none!important;width:100%!important;min-width:0;height:auto;padding:12px!important;border:0;overflow:visible}
 body .sidebar-navigation-dialog .sidebar .nav-item{width:100%;min-height:44px;padding:10px 12px;font-size:14px;gap:10px}
 body .sidebar-navigation-dialog .sidebar .nav-label,body .sidebar-navigation-dialog .sidebar .nav-badge,body .sidebar-navigation-dialog .sidebar .nav-arrow{display:inline;font-size:inherit}
 body .sidebar-navigation-dialog .sidebar .sidebar-bottom{display:block;margin-top:14px}
 body .sidebar-navigation-dialog .sidebar .sidebar-topics{padding:4px 0}
 body .sidebar-navigation-dialog .sidebar .sidebar-topics summary{font-size:14px;min-height:44px;padding:10px 12px;box-sizing:border-box}
 body .sidebar-navigation-dialog .sidebar .sidebar-topics summary span{display:inline}
 body .sidebar-navigation-dialog .sidebar .sidebar-topic{font-size:13px;min-height:40px}
 body .sidebar-navigation-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;padding:12px;border-top:1px solid var(--ws-line);font-size:13px;flex:0 0 auto}
 body .sidebar-navigation-footer a,body .sidebar-navigation-footer button{min-height:40px;display:flex;align-items:center}
}
@media screen and (max-width:1023px){
 body .menubar{gap:8px}
 body .menubar .menutitle,body .menubar #clock{display:none}
 body .menubar .sidebar-toggle{display:flex;align-items:center;justify-content:center}
 body .menubar .top-search{flex:1 1 auto;max-width:260px}
 body .menubar .top-search kbd{display:none}
 body .library-layout > .sidebar{display:none!important}
 body .library-layout{display:flex}
 body .library-body{min-width:0;width:100%}
 body #reader.reader-window{top:var(--svgn-content-top)!important;bottom:calc(var(--svgn-bottom-clearance) + env(safe-area-inset-bottom,0px))!important;left:12px!important;right:12px!important;width:auto!important;height:auto!important}
 body[data-spatial-view="explore"] .desktop{width:auto;right:12px;pointer-events:auto}
}
@media screen and (max-width:900px){
 :root{--svgn-content-top:232px}
 body #appearance-toolbar{grid-template-columns:auto minmax(0,1fr) minmax(0,1fr);gap:6px 8px}
 body #appearance-toolbar .appearance-contrast{grid-column:1 / 3;grid-row:2}
 body #appearance-toolbar #quick-clear{grid-column:3;grid-row:2;justify-self:end}
}
@media screen and (max-width:760px){
 body .menubar{left:8px;right:8px;padding:0 8px;gap:6px}
 body .menubar .brand{gap:5px}
 body .menubar .brand strong{font-size:16px}
 body .menubar .menu-end{gap:0}
 body .menubar .menu-end .account-link,body .menubar .menu-end [data-view="about"]{display:none}
 body .menubar .top-search{min-width:72px;gap:5px;padding:0 6px!important;max-width:none}
 body .desktop-heading{display:none}
 body .library-window{top:0!important}
 body .desktop,body[data-spatial-view="explore"] .desktop{left:8px;right:8px;width:auto;top:var(--svgn-content-top);bottom:calc(var(--svgn-bottom-clearance) + env(safe-area-inset-bottom,0px))}
 body #reader.reader-window{left:8px!important;right:8px!important;width:auto!important}
 body .news-ticker{left:8px;right:8px;gap:5px;padding:0 6px}
 body .news-ticker>strong{font-size:11px}
 body #appearance-toolbar{left:8px;right:8px;padding:6px 8px}
}
@media screen and (max-width:600px){
 body #appearance-toolbar{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}
 body #appearance-toolbar .appearance-palette-button{display:none}
 body #appearance-toolbar .appearance-choice:first-of-type{grid-column:1}
 body #appearance-toolbar .appearance-choice:nth-of-type(2){grid-column:2 / 4}
 body #appearance-toolbar .appearance-contrast{grid-column:1 / 3}
 body #appearance-toolbar #quick-clear{grid-column:3}
 body #appearance-toolbar .appearance-range span{font-size:10px}
}
@media screen and (max-width:359px){
 body .menubar .brand strong{display:none}
 body .dock{grid-template-columns:repeat(4,minmax(0,1fr))}
}
@media (prefers-reduced-motion:reduce){
 body.relief-ready .dock[data-liquid-owner],body.graphics-recovering .dock[data-liquid-owner]{transform:none!important}
}


/* In a short viewport, leave room to browse and read below the main bar. */
@media screen and (max-height:640px), screen and (min-width:681px) and (max-width:760px) and (max-height:700px){
 body:has(#reader:not([hidden])):not([data-spatial-view="explore"]) #reader.reader-window{
   top:68px!important;right:8px!important;bottom:calc(8px + env(safe-area-inset-bottom,0px))!important;left:8px!important;
   margin:0!important;width:auto!important;height:auto!important;
 }
 body:has(.menubar):not([data-spatial-view="explore"]) #reader>.reader-titlebar{padding:1px 8px;min-height:46px}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader>.reader-titlebar>.window-mark{display:none!important}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader>.reader-titlebar>.reader-tools{width:auto;flex:1;min-width:0}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader :is(.desktop-window-action,.geometry-reset,.resize-handle){display:none!important}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader .reader-tools{flex-wrap:nowrap;gap:4px;justify-content:flex-end}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader [data-action="deck"]{flex:0 0 auto;min-width:44px;padding-inline:6px;justify-content:center}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader .article-transparency{flex:1 1 94px;min-width:90px;max-width:145px;margin:0}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader .article-transparency input{width:100%}
 body:has(#reader:not([hidden])):not([data-spatial-view="explore"]) :is(#news-ticker-slot,.news-ticker,#appearance-toolbar,.dock,#spatial-hud){display:none!important}
}

@media screen and (max-height:500px){
 body:has(.menubar):not([data-spatial-view="explore"]) :is(#news-ticker-slot,.news-ticker,#appearance-toolbar){display:none!important}
 body:has(.menubar):not([data-spatial-view="explore"]) .desktop{top:68px!important}
}

@media screen and (max-height:640px) and (min-width:761px){
 body:has(.menubar):not([data-spatial-view="explore"]) #reader>.reader-titlebar>.window-mark{display:flex!important}
}

@media screen and (max-height:640px) and (max-width:360px){
 body:has(.menubar):not([data-spatial-view="explore"]) #reader>.reader-titlebar{padding-inline:6px}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader .reader-tools{gap:2px;justify-content:space-between}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader [data-action="deck"]{padding-inline:4px}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader [data-action="deck"] svg{display:none}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader .article-transparency>span{gap:4px;flex-wrap:wrap}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader .article-transparency output{min-width:0}
}

/* Give the active card the space left by its heading and navigation. */
@media screen and (max-height:820px), screen and (max-width:900px) and (max-height:900px){
 body:not([data-spatial-view="explore"]) #reader #deck-panel:not([hidden]){padding:10px}
 body:not([data-spatial-view="explore"]) #reader #deck-panel>.deck-heading{margin-bottom:6px}
 body:not([data-spatial-view="explore"]) #reader #deck-card{padding:12px}
 body:not([data-spatial-view="explore"]) #reader .deck-controls{position:static;margin-top:6px;padding:0}
 body:not([data-spatial-view="explore"]) #reader .deck-footnote{display:none}
}

@media screen and (max-height:420px){
 /* Close deck remains in the window bar. Its controls stay below the card. */
 body:has(.menubar):not([data-spatial-view="explore"]) #reader #deck-panel>.deck-heading{display:none}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader #deck-panel:not([hidden]){padding:6px}
 body:has(.menubar):not([data-spatial-view="explore"]) #reader #deck-card{padding:8px 12px}
}

@media screen and (max-height:420px) and (max-width:1023px){
 /* The menu takes over section navigation; keep access to the existing view modes. */
 body:has(.menubar):not([data-spatial-view="explore"]) .dock{display:none!important}
 body:has(.menubar):not([data-spatial-view="explore"]) #spatial-hud{bottom:calc(8px + env(safe-area-inset-bottom,0px))!important}
 body:has(.menubar):not([data-spatial-view="explore"]) .desktop{bottom:calc(64px + env(safe-area-inset-bottom,0px))!important}
}

/* Videos and Research put title search and the current results first. */
.library-shelf { min-width: 0; }
.library-shelf-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}
.library-shelf-tools > .shelf-query {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding-block: 8px;
}
.library-shelf-tools > .shelf-filter-panel { min-width: 0; }
.library-shelf-tools > .shelf-filter-panel[open] { grid-column: 1 / -1; }
.shelf-filter-panel > summary {
  display: list-item;
  align-content: center;
  box-sizing: border-box;
  min-height: 44px;
  min-width: 74px;
  padding: 9px 12px;
  background: var(--ws-soft);
  border: 1px solid var(--ws-line);
  color: var(--ws-ink);
  cursor: pointer;
}
.shelf-filter-panel > summary:focus-visible {
  outline: 2px solid var(--ws-accent);
  outline-offset: 2px;
}
.shelf-filter-panel > summary::marker { color: var(--ws-accent); }
.library-shelf .shelf-status,
body .library-shelf #research-status { margin: 10px 0; color: var(--ws-ink); font-size: 13px; line-height: 1.45; }
.shelf-results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 10px; }
.shelf-results-head > a { display: inline-flex; align-items: center; min-height: 24px; color: var(--ws-accent); font-size: 13px; }
.library-shelf > :is(.research-intro, .research-classification, .video-provenance) { margin-top: 20px; }
.videos-shelf #video-list .paper-row h3 { margin: 0 0 8px; }
body:not([data-spatial-view="explore"]) .library-window:has(.library-shelf) .library-toolbar {
  margin-bottom: 12px;
}
body:not([data-spatial-view="explore"]) .library-window:has(.library-shelf) .library-toolbar .eyebrow {
  display: none;
}

@media screen and (max-height:500px) {
  /* The titlebar and main Search control are already present in this layout. */
  body:not([data-spatial-view="explore"]) .library-window #library:has(.library-shelf) {
    padding-block: 8px !important;
  }
  body:not([data-spatial-view="explore"]) .library-window #library:has(.library-shelf) .library-toolbar { display: none !important; }
  .library-shelf .shelf-status,
  body .library-shelf #research-status { margin: 6px 0; }
  .videos-shelf #video-list .paper-row { padding: 10px; }
  .research-shelf #research-list .paper-row { padding-block: 8px; }
  .research-shelf #research-list .paper-row h3 { margin-block: 0 4px; }
}

@media (forced-colors: active) {
  .shelf-filter-panel > summary { background: Canvas; color: CanvasText; border-color: ButtonText; }
  .shelf-filter-panel > summary::marker { color: CanvasText; }
  .shelf-filter-panel > summary:focus-visible { outline-color: Highlight; }
}

/* Keep paper, its inset media mat and deck controls on the same palette. */
@media screen and (forced-colors: none) {
  body #reader #deck-panel {
    background: var(--ws-soft);
  }

  body #reader #deck-card {
    background: var(--ws-panel);
    border-color: var(--ws-line);
  }

  body #reader #article .article-cover {
    background: linear-gradient(145deg, var(--ws-soft), var(--ws-panel));
    border-color: var(--ws-line);
  }

  html body[data-ink] #reader :is(.eyebrow, .tag) {
    color: var(--ws-accent) !important;
  }

  body #reader .deck-controls {
    background: var(--ws-panel);
  }

  body #reader .deck-controls button:not(:disabled) {
    background: var(--ws-soft);
    color: var(--ws-ink);
  }

  html body[data-ink][data-theme] :is(.dock.glass .dock-item.active,
      #spatial-hud .spatial-view-controls button[aria-pressed="true"], .sidebar .nav-item.active) {
    background: var(--ws-tint);
    color: var(--ws-ink) !important;
  }
}
