/* Shared controls: a quiet six-dot grip, close action, and corner resize target. */
html body :is(.widget-grip,.widget-resize){box-sizing:border-box;color:var(--muted);background:transparent;border:0;padding:0;touch-action:none;-webkit-user-select:none;user-select:none}
html body .widget-grip{display:grid;place-items:center;width:28px;min-width:28px;max-width:28px;height:36px;min-height:36px;flex:0 0 28px;cursor:grab}
html body .widget-grip:active{cursor:grabbing}
html body :is(.widget-grip,.widget-resize):hover{color:var(--ink)}
html body .widget-grip svg{display:block;width:18px;height:18px}
html body .widget-resize svg{display:block;width:24px;height:24px}
html body .widget-resize::after{content:none}
html body[data-screen=desktop] :is(.game-widget,.game-window,.movable-popup)>.widget-resize{display:grid;place-items:center;width:28px;min-width:28px;height:28px;min-height:28px;cursor:nwse-resize;border:0;background:transparent;padding:0}
html body[data-screen=desktop] .movable-popup>.widget-resize{position:fixed;right:auto;bottom:auto;z-index:10}
html body .popup-header{display:flex;align-items:center;gap:8px;-webkit-user-select:none;user-select:none}
.popup-header>.widget-grip{order:-1}
.popup-header>.popup-title{flex:1;min-width:0}
html body dialog.popup-positioned{position:fixed;right:auto;bottom:auto;margin:0;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);box-sizing:border-box}
html body[data-screen=desktop] #history-popover.floating-panel{position:fixed;display:flex;flex-direction:column;margin:0;max-height:calc(100dvh - 16px);overflow:hidden;padding-bottom:20px}
html body #history-popover .panel-header{display:flex;align-items:center;gap:6px;min-height:44px;border-bottom:1px solid var(--line)}
html body #history-popover .panel-header .widget-grip{order:-1}
html body #history-popover .panel-header .history-close{margin-left:auto}
html body #history-popover.floating-panel>.history-panel{display:flex;flex-direction:column;flex:1;min-height:0}
html body #history-popover.floating-panel #history-list{flex:1;min-height:0;overflow:auto}
html body[data-sidebar-locked=true] :is(.game-widget,.game-window) :is(.widget-grip,.widget-resize),
html body[data-screen=mobile] :is(.widget-grip,.widget-resize){display:none!important}
html body .toolbar-grip svg{display:block;width:16px;height:16px;transform:rotate(90deg)}
/* Raise the owning stacking context, not just the dropdown inside it. */
html body.compact-controls[data-screen] .board-toolbar:has(details[open]),
html body.compact-controls[data-screen] .board-footer:has(#mobile-game-select[open]),
html body.compact-controls[data-screen] .workspace-bar:has(details[open]){z-index:2600!important}
html body.compact-controls[data-screen] .board-section:has(.board-toolbar details[open],.workspace-bar details[open]){z-index:2500}
