/* Image navigation and flexible Library window. */
#wrap.hand, #wrap.hand #cv { cursor: grab !important; }
#wrap.grabbing, #wrap.grabbing #cv { cursor: grabbing !important; user-select: none; }
#wrap.hand ~ .overlay { visibility: hidden; }
#libMgr { width: min(960px, calc(100dvw - 16px)); height: min(640px, calc(100dvh - 16px)); max-width: calc(100dvw - 16px); max-height: calc(100dvh - 16px); box-sizing: border-box; }
#libMgr > .bar { flex: 0 0 auto; flex-wrap: wrap; }
#libMgr > .bar:first-child { touch-action: none; cursor: move; }
#libMgr > .bar:last-of-type { padding-right: 32px; }
#libMgr .pgp-modal-body { flex: 1 1 0; min-height: 0; height: auto; max-height: none; grid-template-columns: minmax(180px, 30%) minmax(0, 1fr); }
#libMgr #libList { min-height: 0; max-height: none; }
#libMgr #libDetail { min-height: 0; min-width: 0; }
#libMgr .hd2, #libMgr #libTop { flex-wrap: wrap; }
#libMgr .lib-resize { position: absolute; right: 0; bottom: 0; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 0 0 11px 0; cursor: nwse-resize; touch-action: none; background: transparent; }
#libMgr .lib-resize::after { content: ''; position: absolute; right: 6px; bottom: 6px; width: 12px; height: 12px; opacity: .7; background: linear-gradient(135deg, transparent 0 45%, #999 45% 51%, transparent 51% 64%, #999 64% 70%, transparent 70% 83%, #999 83% 89%, transparent 89%); pointer-events: none; }
#libMgr .lib-resize:focus-visible { outline: 2px solid var(--acc, #bbef58); outline-offset: -3px; }
@media(max-width:640px) {
  #libMgr .pgp-modal-body { display: flex; flex-direction: column; }
  #libMgr #libList { flex: 0 0 40%; }
  #libMgr #libDetail { flex: 1 1 0; width: auto; }
}

/* Compact navigation controls keep the desktop toolbar usable. */
#zoomRange { width: 90px; }
#btnHand { display: inline-flex; align-items: center; justify-content: center; gap: 3px; padding-left: 9px; padding-right: 11px; }
#btnHand .hand-icon { display: block; flex: 0 0 18px; width: 18px; height: 18px; background: currentColor; -webkit-mask: url("../icons/hand-palm.png") center / contain no-repeat; mask: url("../icons/hand-palm.png") center / contain no-repeat; }

/* Tight spacing, with a second row whenever the available width needs it. */
.tool { gap: 6px; flex-wrap: wrap; }
.tool > .div { margin: 0 2px; }
.tool > #live { min-width: 0; max-width: 100%; box-sizing: border-box; }
#live > div:last-child { min-width: 0; }
#liveVals { overflow-wrap: anywhere; }

/* The mobile analyzer occupies its own row between canvas and Active Swatches. */
@media (max-width: 900px) {
  .main > #paletteBar { box-sizing: border-box; width: 100%; min-width: 0; margin: 0; }
}
