/* Compact workspace controls. All map/search/direction actions keep their original DOM. */
html.shpk-map{
  --compact-edge:8px;
  --compact-search-width:clamp(240px,30vw,350px);
  --compact-controls-bottom:46px;
  --shpk-pins-height:36px;
}
html.shpk-map #searchBox{
  left:var(--compact-edge)!important;right:auto!important;top:8px!important;
  width:var(--compact-search-width)!important;max-width:none!important;
}
html.shpk-map #searchBox>.search-symbol{left:11px;top:10px;width:18px;height:18px}
html.shpk-map #searchInp{
  width:100%!important;height:38px!important;min-height:38px!important;line-height:38px!important;
  padding:0 28px 0 36px!important;border-radius:10px!important;font-size:13px!important;
  box-shadow:0 3px 12px #0003!important;
}
html.shpk-map #searchRes{
  top:44px!important;border-radius:10px!important;
  max-height:calc(100dvh - var(--dock-top-gap,100px) - 68px)!important;
}
html.shpk-map #searchRes .shpk-search-option{
  grid-template-columns:23px minmax(0,1fr);gap:7px;padding:9px 11px;min-height:47px;
}
html.shpk-map #searchRes .shpk-search-title{font-size:13px}
html.shpk-map #searchRes .shpk-search-subtitle{font-size:10px;margin-top:2px}
html.shpk-map #searchRes .shpk-search-icon{width:23px;height:27px}
html.shpk-map #searchRes .shpk-search-caption{padding:7px 11px;font-size:9px}
html.shpk-map #searchRes .shpk-search-notice{padding:10px 11px}
html.shpk-map #map-chips{
  left:calc(var(--compact-search-width) + var(--compact-edge) + 7px);
  right:118px;top:10px;display:flex;gap:5px;padding:0;
  overflow:visible;white-space:nowrap;min-height:34px;
}
html.shpk-map #map-chips>.map-chip,
html.shpk-map #map-chips>#shpk-direction-toggle{
  display:inline-flex;align-items:center;justify-content:center;gap:5px;
  min-height:34px;height:34px;min-width:0;flex:0 1 auto;
  padding:0 9px;border-radius:9px;font-size:11px;line-height:1.2;
  box-shadow:0 2px 8px #0002;border:1px solid #ffffff20;
}
html.shpk-map #map-chips>.map-chip.active{
  border-color:#bfec6d66;
}
html.shpk-map #map-chips .map-chip .ui-icon,
html.shpk-map #map-chips>#shpk-direction-toggle svg{width:14px;height:14px;flex:none}
html.shpk-map #map-chips>#shpk-direction-toggle{order:4}
html.shpk-map #map-chips>#shpk-direction-toggle[aria-expanded=true]{
  background:#32585b;color:#d8ffff;border-color:#99dbe677;
}
html.shpk-map #shpk-direction-reopen{display:none!important}
html.shpk-map #map-clock{
  right:8px;top:10px;height:34px;gap:7px;padding:0 10px;border-radius:9px;
}
html.shpk-map #map-clock strong{font-size:11px}
html.shpk-map #map-clock small{font-size:9px}

/* A saved pin occupies one compact row; additional pins wrap instead of sliding sideways. */
html.shpk-map #shpk-pins{
  left:var(--compact-edge);right:auto;top:calc(var(--compact-controls-bottom) + 6px);
  width:var(--compact-search-width);padding:4px;display:flex;align-items:flex-start;
  gap:5px;border-radius:9px;font-size:11px;
}
html.shpk-map #shpk-pins .pin-header{flex:none;display:flex;gap:3px;padding:0;margin:0}
html.shpk-map #shpk-pins .pin-header>span{
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;
  clip-path:inset(50%);white-space:nowrap;border:0;
}
html.shpk-map #shpk-pins .pin-header button{height:26px;padding:3px 5px;font-size:10px}
html.shpk-map #shpk-pins .pin-chips{
  display:flex;flex:1;min-width:0;flex-wrap:wrap;gap:4px;
  overflow-x:hidden;overflow-y:auto;max-height:86px;overscroll-behavior:contain;
}
html.shpk-map #shpk-pins .pin-chip{height:26px;max-width:100%;min-width:0;font-size:10px}
html.shpk-map #shpk-pins .pin-chip button:first-child{min-width:0;max-width:100%;padding:3px 6px;flex:1}
html.shpk-map #shpk-pins .pin-chip button:last-child{width:24px;height:24px;padding:0;flex:none;font-size:15px}
html.shpk-map #shpk-place-card{
  left:var(--compact-edge)!important;right:auto!important;
  top:calc(var(--compact-controls-bottom) + 6px)!important;
  width:var(--compact-search-width)!important;padding:10px;border-radius:11px;
  max-height:calc(100dvh - var(--compact-controls-bottom) - var(--dock-top-gap,100px) - 20px)!important;
  overflow:auto;
}
html.shpk-map.has-search-pins #shpk-place-card{
  top:calc(var(--compact-controls-bottom) + var(--shpk-pins-height) + 12px)!important;
  max-height:calc(100dvh - var(--compact-controls-bottom) - var(--shpk-pins-height) - var(--dock-top-gap,100px) - 26px)!important;
}
html.shpk-map #shpk-place-card h2{font-size:16px;margin:3px 24px 5px 0}
html.shpk-map #shpk-place-card .shpk-place-tag{font-size:8px}
html.shpk-map #shpk-place-card .shpk-place-region{font-size:10px;margin-bottom:6px}
html.shpk-map #shpk-place-card .shpk-place-actions{gap:5px;padding-top:6px;flex-wrap:wrap}
html.shpk-map #shpk-place-card .shpk-place-actions button{padding:6px;font-size:10px}
html.shpk-map #shpk-place-card .shpk-place-coordinates{font-size:10px;margin-top:6px}

/* The same direction button is available on every screen width. */
html.shpk-map #shpk-direction,
html.shpk-map.has-search-pins #shpk-direction{
  left:auto;right:8px;top:calc(var(--compact-controls-bottom) + 6px);
  width:min(390px,calc(100vw - 16px));border-radius:11px;
}
html.shpk-map #shpk-direction .direction-head{padding:6px 9px;gap:6px;min-height:34px}
html.shpk-map #shpk-direction .direction-head strong{font-size:11px}
html.shpk-map #shpk-direction .direction-head span{font-size:9px}
html.shpk-map #shpk-direction .direction-close{width:26px;height:26px;padding:0}
html.shpk-map #shpk-direction .direction-body{padding:8px 9px 9px}
html.shpk-map #shpk-direction .direction-fields{grid-template-columns:minmax(0,1fr) 27px minmax(0,1fr);gap:5px}
html.shpk-map #shpk-direction label{margin-bottom:4px;font-size:10px}
html.shpk-map #shpk-direction input{min-height:34px;height:34px;padding:6px 7px;font-size:12px;border-radius:7px}
html.shpk-map #shpk-direction .direction-swap{min-height:34px;height:34px;margin-top:18px;padding:4px 0}
html.shpk-map #shpk-direction .direction-targets:empty{margin-bottom:0}
html.shpk-map #shpk-direction .direction-target-chip{max-width:100%;font-size:10px}
html.shpk-map #shpk-direction .direction-actions{margin-top:7px;gap:5px}
html.shpk-map #shpk-direction .direction-add,
html.shpk-map #shpk-direction .direction-reset{padding:7px 8px;min-height:32px;font-size:11px}
html.shpk-map #shpk-direction .direction-message{margin-top:5px;font-size:10px;min-height:14px}
html.shpk-map #shpk-direction .direction-footer{font-size:9px;line-height:1.4;margin-top:6px}
html.shpk-map #shpk-direction .direction-saved-head{margin-top:7px;padding-top:7px}
html.shpk-map #shpk-direction .direction-saved{max-height:105px}
html.shpk-map #shpk-direction .direction-saved-head[hidden],html.shpk-map #shpk-direction .direction-saved[hidden]{display:none}
html.shpk-map #shpk-direction .direction-option{padding:6px 7px;min-height:39px}
html.shpk-map #shpk-direction .direction-option strong{font-size:11px}
html.shpk-map #shpk-direction .direction-option span{font-size:9px}
html.shpk-map #shpk-direction .direction-show{padding:5px 7px;font-size:10px}
html.shpk-map #shpk-direction .direction-remove{min-width:28px;min-height:28px;padding:3px 6px}

@media(max-width:1039px){
  html.shpk-map #map-clock{display:none}
  html.shpk-map #map-chips{right:8px}
}
@media(max-width:719px){
  html.shpk-map{--compact-search-width:calc(100vw - 16px);--compact-controls-bottom:83px}
  html.shpk-map #searchBox{left:8px!important;right:8px!important;top:8px!important;width:auto!important}
  html.shpk-map #map-chips{
    left:8px;right:8px;top:51px;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;
    min-height:32px;
  }
  html.shpk-map #map-chips>.map-chip,
  html.shpk-map #map-chips>#shpk-direction-toggle{
    height:32px;min-height:32px;width:100%;padding:0 5px;gap:4px;font-size:10px;
  }
  html.shpk-map #map-chips .map-chip .ui-icon,
  html.shpk-map #map-chips>#shpk-direction-toggle svg{width:13px;height:13px}
  html.shpk-map #searchRes{top:81px!important}
  html.shpk-map #shpk-pins{left:8px;right:8px;width:auto}
  html.shpk-map #shpk-place-card{left:8px!important;right:auto!important;width:min(380px,calc(100vw - 16px))!important}
  html.shpk-map #shpk-direction,
  html.shpk-map.has-search-pins #shpk-direction{
    left:8px;right:8px;top:calc(var(--compact-controls-bottom) + 6px);width:auto;z-index:25;
  }
  html.shpk-map.direction-open #shpk-pins{visibility:hidden;pointer-events:none}
  html.shpk-map.direction-open #shpk-place-card{visibility:hidden}
}
@media(max-width:359px){
  html.shpk-map #map-chips .map-chip .ui-icon,
  html.shpk-map #map-chips>#shpk-direction-toggle svg{display:none}
  html.shpk-map #map-chips>.map-chip,
  html.shpk-map #map-chips>#shpk-direction-toggle{padding:0 3px;font-size:10px}
}
