/* One bottom tray on phones, tablets and desktop; reuse the approved menu palette. */
.r512-menu { width:100%; height:0; inset:auto 0 0; z-index:180; }
.r512-menu[data-open=true] { width:100%; }
.r512-menu .r512-backdrop { display:block; }
.r512-menu .r512-surface,
.r512-menu[data-mode=favorites] .r512-surface {
  top:auto; bottom:max(0px,calc(100dvh - var(--r512-vtop,0px) - var(--r512-vh,100dvh)));
  left:0; right:0; width:auto; height:var(--r512-tray-height,calc(var(--r512-vh,100dvh) - 16px));
  max-height:var(--r512-vh,100dvh); border-radius:24px 24px 0 0; border:1px solid var(--r512-line);
  border-bottom:0; padding-top:0; contain:layout;
}
.r512-menu .r512-grip,
.r512-menu[data-compact=true] .r512-grip {
  display:grid; min-height:48px!important; width:100%; padding:8px!important;
  touch-action:none!important; user-select:none; cursor:grab; flex:none;
}
.r512-menu[data-dragging=true] .r512-grip { cursor:grabbing; }
.r512-menu .r512-grip small { font-size:12px; line-height:1.4; color:var(--r512-muted); }
.r512-menu .r512-grip:active { transform:none; }
.r512-menu .r512-grip .house-grip-texture { width:76px; height:10px; border-radius:8px; }
.r512-menu .r512-surface header { padding:8px 16px 16px; }
.r512-menu .r512-surface h2 { margin:4px 0 16px; }
.r512-menu .r512-scroll { padding:0 16px 24px; }
.r512-menu .r512-destination { flex-direction:column; align-items:center; text-align:center; gap:12px; }
.r512-menu .r512-directory .r512-destination { flex-direction:row; text-align:left; }
.r512-menu .r512-surface footer { padding:12px 16px max(16px,env(safe-area-inset-bottom)); }
.r512-menu .r512-rail { height:100dvh; position:fixed; top:0; left:0; }
.r512-menu .r512-tray-launcher { display:none; }
@media(min-width:701px) {
 .r512-menu .r512-tray-launcher {
  display:grid; position:fixed; bottom:max(8px,env(safe-area-inset-bottom));
  left:50%; transform:translateX(-50%); width:112px; pointer-events:auto;
  background:var(--r512-surface); border:1px solid var(--r512-line); border-radius:16px;
 }
 .r512-menu .r512-tray-launcher:active { transform:translateX(-50%); }
}
html[data-menu-tray] .shell>.main,
html[data-menu-tray=expanded] .shell>.main { margin-left:0!important; width:100%!important; }
@media(min-width:40rem) {
 .r512-menu .r512-surface,.r512-menu[data-mode=favorites] .r512-surface {
  left:max(16px,calc((100vw - 960px)/2)); right:max(16px,calc((100vw - 960px)/2));
 }
 .r512-menu .r512-surface header { padding:8px 32px 16px; }
 .r512-menu .r512-scroll { padding:0 32px 24px; }
 .r512-menu .r512-surface footer { padding-left:32px; padding-right:32px; }
 .r512-menu .r512-grid { grid-template-columns:repeat(auto-fit,minmax(min(100%,max(7rem,calc((100% - 72px)/4))),1fr)); gap:16px 24px; }
 .r512-menu .r512-directory { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(min-width:64rem) {
 .r512-menu .r512-tray-launcher { left:calc(50% + 2rem); }
 html[data-menu-tray] .shell>.main,html[data-menu-tray=expanded] .shell>.main { margin-left:4rem!important; width:calc(100% - 4rem)!important; }
 .r512-menu .r512-surface,.r512-menu[data-mode=favorites] .r512-surface {
  left:max(calc(4rem + 16px),calc((100vw - 960px + 4rem)/2)); right:max(16px,calc((100vw - 960px - 4rem)/2));
 }
}
@media(max-height:499px) {
 .r512-menu .r512-surface header { padding-top:0; padding-bottom:8px; }
 .r512-menu .r512-surface footer { padding-top:8px; padding-bottom:max(8px,env(safe-area-inset-bottom)); }
}
@media(prefers-reduced-motion:reduce) { .r512-menu .r512-surface { scroll-behavior:auto; } }
